@johnboxcodes/boxlogger 0.3.0 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -239,33 +239,56 @@ const stats = await Sentry.getStats();
|
|
|
239
239
|
| `beforeSend` | `function` | - | Hook to modify/filter events |
|
|
240
240
|
| `beforeSendMessage` | `function` | - | Hook to modify/filter messages |
|
|
241
241
|
|
|
242
|
-
## Examples
|
|
243
|
-
|
|
244
|
-
See the [examples](./examples) directory for complete examples:
|
|
245
|
-
- [examples/simple.js](./examples/simple.js) - Quick start example (run with `node examples/simple.js`)
|
|
246
|
-
- [examples/server.ts](./examples/server.ts) - Express server with error tracking
|
|
247
|
-
- [examples/console-demo.ts](./examples/console-demo.ts) - Console provider with colorful output
|
|
248
|
-
- [examples/nextjs-integration.tsx](./examples/nextjs-integration.tsx) - Next.js integration (server + client)
|
|
249
|
-
|
|
250
242
|
## Next.js Integration
|
|
251
243
|
|
|
252
|
-
|
|
244
|
+
Perfect for development! Use boxlogger locally and Sentry in production with the same API.
|
|
245
|
+
|
|
246
|
+
### Development + Production Setup
|
|
253
247
|
|
|
254
248
|
```typescript
|
|
255
|
-
//
|
|
256
|
-
|
|
257
|
-
|
|
249
|
+
// sentry.server.config.ts
|
|
250
|
+
import * as Sentry from '@sentry/nextjs';
|
|
251
|
+
|
|
252
|
+
if (process.env.NODE_ENV === 'development') {
|
|
253
|
+
// Development: Use boxlogger with colorful console output
|
|
254
|
+
const boxlogger = await import('@johnboxcodes/boxlogger');
|
|
255
|
+
await boxlogger.init('console', {
|
|
256
|
+
service: 'my-app',
|
|
257
|
+
environment: 'development',
|
|
258
|
+
minLevel: 'debug',
|
|
259
|
+
});
|
|
260
|
+
Object.assign(Sentry, boxlogger);
|
|
261
|
+
} else {
|
|
262
|
+
// Production: Use real Sentry
|
|
263
|
+
Sentry.init({
|
|
264
|
+
dsn: process.env.SENTRY_DSN,
|
|
265
|
+
tracesSampleRate: 0.1,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
```
|
|
258
269
|
|
|
259
|
-
|
|
260
|
-
await Sentry.init('console', {
|
|
261
|
-
service: 'my-nextjs-app',
|
|
262
|
-
environment: 'development'
|
|
263
|
-
});
|
|
270
|
+
### Benefits
|
|
264
271
|
|
|
265
|
-
|
|
266
|
-
|
|
272
|
+
**Development:**
|
|
273
|
+
- Beautiful colorful console output
|
|
274
|
+
- No Sentry quota usage
|
|
275
|
+
- Works offline
|
|
276
|
+
- Instant feedback
|
|
267
277
|
|
|
268
|
-
|
|
278
|
+
**Production:**
|
|
279
|
+
- Full Sentry features (alerts, dashboards, replays)
|
|
280
|
+
- Error aggregation and monitoring
|
|
281
|
+
- Same API - just change `NODE_ENV`!
|
|
282
|
+
|
|
283
|
+
See [examples/nextjs-integration.tsx](./examples/nextjs-integration.tsx) for complete setup including Edge runtime and client components.
|
|
284
|
+
|
|
285
|
+
## Examples
|
|
286
|
+
|
|
287
|
+
See the [examples](./examples) directory for complete examples:
|
|
288
|
+
- [examples/simple.js](./examples/simple.js) - Quick start example (run with `node examples/simple.js`)
|
|
289
|
+
- [examples/server.ts](./examples/server.ts) - Express server with error tracking
|
|
290
|
+
- [examples/console-demo.ts](./examples/console-demo.ts) - Console provider with colorful output
|
|
291
|
+
- [examples/nextjs-integration.tsx](./examples/nextjs-integration.tsx) - Next.js integration (server + client)
|
|
269
292
|
|
|
270
293
|
## License
|
|
271
294
|
|
package/package.json
CHANGED