@rawnodes/logger 1.8.0 → 1.9.0
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 +33 -0
- package/dist/index.d.mts +760 -4
- package/dist/index.d.ts +760 -4
- package/dist/index.js +105 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +92 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -297,6 +297,39 @@ All external transports support:
|
|
|
297
297
|
| `maxRetries` | 3 | Retry count on failure |
|
|
298
298
|
| `retryDelay` | 1000 | Base retry delay in ms |
|
|
299
299
|
|
|
300
|
+
### Multiple Transports
|
|
301
|
+
|
|
302
|
+
You can configure multiple instances of the same transport type using arrays:
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
const logger = Logger.create({
|
|
306
|
+
level: 'info',
|
|
307
|
+
console: { format: 'plain' },
|
|
308
|
+
discord: [
|
|
309
|
+
{
|
|
310
|
+
webhookUrl: 'https://discord.com/api/webhooks/payments/xxx',
|
|
311
|
+
level: 'off',
|
|
312
|
+
rules: [{ match: { context: 'payments' }, level: 'error' }],
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
webhookUrl: 'https://discord.com/api/webhooks/auth/yyy',
|
|
316
|
+
level: 'off',
|
|
317
|
+
rules: [{ match: { context: 'auth' }, level: 'error' }],
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
telegram: [
|
|
321
|
+
{ botToken: 'token1', chatId: 'errors-chat', level: 'error' },
|
|
322
|
+
{ botToken: 'token2', chatId: 'alerts-chat', level: 'warn' },
|
|
323
|
+
],
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// Payment errors go to payments Discord channel
|
|
327
|
+
logger.for('payments').error('Payment failed');
|
|
328
|
+
|
|
329
|
+
// Auth errors go to auth Discord channel
|
|
330
|
+
logger.for('auth').error('Login failed');
|
|
331
|
+
```
|
|
332
|
+
|
|
300
333
|
## Singleton Pattern
|
|
301
334
|
|
|
302
335
|
For app-wide logging:
|