@arivlabs/logger 1.4.1 → 2.0.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/dist/index.js CHANGED
@@ -1,16 +1,93 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ /**
3
+ * @arivlabs/logger v2.0.0
4
+ *
5
+ * Structured logging for Node.js services with CloudWatch support.
6
+ *
7
+ * Features:
8
+ * - Async logging by default (high performance, non-blocking via SonicBoom)
9
+ * - Crash-safe logging via synchronous flush on fatal errors
10
+ * - Flexible types (define your own service/domain types)
11
+ * - Automatic sensitive data redaction
12
+ * - Child loggers with context
13
+ * - Graceful shutdown with proper drain handling
14
+ * - Buffer metrics for operational observability
15
+ *
16
+ * Architecture Notes:
17
+ * - Production mode uses pino.destination() (SonicBoom) for buffered async writes
18
+ * - SonicBoom provides flushSync() for crash-safe logging before process exit
19
+ * - Pretty mode uses pino-pretty transport (worker thread) - flush() is a no-op
20
+ * - Sync mode (enableAsync: false) writes immediately - flush() is a no-op
21
+ * - pino.final() was deprecated in Node 14+ and removed in pino v10; we use
22
+ * direct flushSync() calls instead for crash-safe logging
23
+ * - Timestamps use ISO 8601 format with field name "time" (same as pino.stdTimeFunctions.isoTime)
24
+ *
25
+ * Operational Considerations:
26
+ * - Async logging can lose buffered logs on abrupt process termination (SIGKILL, OOM)
27
+ * - flushSync() is best-effort; under extreme backpressure, logs may still be dropped
28
+ * - Worker thread transports (pretty mode) have different ordering/timing guarantees
29
+ * - Use getBufferMetrics() to monitor buffer state in production
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * import { createLogger } from '@arivlabs/logger';
34
+ *
35
+ * const logger = createLogger({ service: 'my-service' });
36
+ *
37
+ * logger.info('Server started', { port: 3000 });
38
+ * logger.domain('auth').info('User logged in', { userId: '123' });
39
+ *
40
+ * // IMPORTANT: Call on shutdown to flush buffered logs
41
+ * process.on('SIGTERM', async () => {
42
+ * await logger.shutdown();
43
+ * process.exit(0);
44
+ * });
45
+ * ```
46
+ */
47
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
48
+ if (k2 === undefined) k2 = k;
49
+ var desc = Object.getOwnPropertyDescriptor(m, k);
50
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
51
+ desc = { enumerable: true, get: function() { return m[k]; } };
52
+ }
53
+ Object.defineProperty(o, k2, desc);
54
+ }) : (function(o, m, k, k2) {
55
+ if (k2 === undefined) k2 = k;
56
+ o[k2] = m[k];
57
+ }));
58
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
59
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
60
+ }) : function(o, v) {
61
+ o["default"] = v;
62
+ });
63
+ var __importStar = (this && this.__importStar) || (function () {
64
+ var ownKeys = function(o) {
65
+ ownKeys = Object.getOwnPropertyNames || function (o) {
66
+ var ar = [];
67
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
68
+ return ar;
69
+ };
70
+ return ownKeys(o);
71
+ };
72
+ return function (mod) {
73
+ if (mod && mod.__esModule) return mod;
74
+ var result = {};
75
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
76
+ __setModuleDefault(result, mod);
77
+ return result;
78
+ };
79
+ })();
5
80
  Object.defineProperty(exports, "__esModule", { value: true });
6
81
  exports.DEFAULT_REDACT_PATHS = void 0;
7
82
  exports.createLogger = createLogger;
8
83
  exports.createDomainLogger = createDomainLogger;
9
84
  exports.createRequestLogger = createRequestLogger;
10
- const pino_1 = __importDefault(require("pino"));
85
+ const pino_1 = __importStar(require("pino"));
11
86
  /**
12
- * Default sensitive field patterns that are always redacted
13
- * These are common security-sensitive fields
87
+ * Default sensitive field patterns that are always redacted.
88
+ * These cover common security-sensitive fields.
89
+ *
90
+ * Note: This is a readonly tuple. When merged with user paths, the result is string[].
14
91
  */
15
92
  exports.DEFAULT_REDACT_PATHS = [
16
93
  // Authentication & Secrets
@@ -36,6 +113,7 @@ exports.DEFAULT_REDACT_PATHS = [
36
113
  '*.apiKey',
37
114
  '*.api_key',
38
115
  '*.accessToken',
116
+ '*.refreshToken',
39
117
  '*.secretAccessKey',
40
118
  '*.privateKey',
41
119
  // Request headers
@@ -48,11 +126,28 @@ exports.DEFAULT_REDACT_PATHS = [
48
126
  'credentials.sessionToken',
49
127
  ];
50
128
  /**
51
- * Normalize error properties in log data
52
- * Converts `error` to `err` for proper pino serialization
129
+ * Type guard to verify a destination has SonicBoom's required methods.
130
+ * This provides runtime safety for the type cast from pino.destination().
131
+ */
132
+ function isSonicBoomDestination(dest) {
133
+ return (dest !== null &&
134
+ typeof dest === 'object' &&
135
+ 'flushSync' in dest &&
136
+ typeof dest.flushSync === 'function' &&
137
+ 'flush' in dest &&
138
+ typeof dest.flush === 'function' &&
139
+ 'end' in dest &&
140
+ typeof dest.end === 'function' &&
141
+ 'destroyed' in dest);
142
+ }
143
+ // =============================================================================
144
+ // INTERNAL HELPERS
145
+ // =============================================================================
146
+ /**
147
+ * Normalize error properties in log data.
148
+ * Converts `error` property to `err` for proper pino serialization.
53
149
  */
54
150
  function normalizeLogData(data) {
55
- // If data has 'error' property that's an Error, rename to 'err' for pino serializer
56
151
  if (data.error instanceof Error && !data.err) {
57
152
  const { error, ...rest } = data;
58
153
  return { ...rest, err: error };
@@ -60,88 +155,173 @@ function normalizeLogData(data) {
60
155
  return data;
61
156
  }
62
157
  /**
63
- * Wrap a pino log method to support flexible calling conventions
158
+ * Create a wrapped log method that supports flexible calling conventions.
64
159
  */
65
- function wrapLogMethod(pinoLogger, level) {
66
- return function (msgOrObj, dataOrMsg) {
160
+ function createLogMethod(pinoLogger, level) {
161
+ // Get the actual pino method
162
+ const pinoMethod = pinoLogger[level];
163
+ return function logMethod(msgOrObj, dataOrMsg) {
67
164
  if (typeof msgOrObj === 'string') {
68
165
  // Called as: logger.info('message') or logger.info('message', { data })
69
- if (dataOrMsg && typeof dataOrMsg === 'object') {
166
+ if (dataOrMsg !== undefined && typeof dataOrMsg === 'object') {
70
167
  const normalized = normalizeLogData(dataOrMsg);
71
- pinoLogger[level](normalized, msgOrObj);
168
+ pinoMethod.call(pinoLogger, normalized, msgOrObj);
72
169
  }
73
170
  else {
74
- pinoLogger[level](msgOrObj);
171
+ pinoMethod.call(pinoLogger, msgOrObj);
75
172
  }
76
173
  }
77
174
  else {
78
175
  // Called as: logger.info({ msg: 'message', data }) or logger.info({ data }, 'message')
79
176
  const normalized = normalizeLogData(msgOrObj);
80
177
  if (typeof dataOrMsg === 'string') {
81
- pinoLogger[level](normalized, dataOrMsg);
178
+ pinoMethod.call(pinoLogger, normalized, dataOrMsg);
82
179
  }
83
180
  else {
84
- pinoLogger[level](normalized);
181
+ pinoMethod.call(pinoLogger, normalized);
85
182
  }
86
183
  }
87
184
  };
88
185
  }
89
186
  /**
90
- * Wrap a pino logger with flexible API
187
+ * Wrap a pino logger with our flexible API.
91
188
  */
92
- function wrapLogger(pinoLogger) {
189
+ function wrapLogger(pinoLogger, state) {
93
190
  const wrapped = {
94
- trace: wrapLogMethod(pinoLogger, 'trace'),
95
- debug: wrapLogMethod(pinoLogger, 'debug'),
96
- info: wrapLogMethod(pinoLogger, 'info'),
97
- warn: wrapLogMethod(pinoLogger, 'warn'),
98
- error: wrapLogMethod(pinoLogger, 'error'),
99
- fatal: wrapLogMethod(pinoLogger, 'fatal'),
100
- domain: (domain) => wrapLogger(pinoLogger.child({ domain })),
101
- withContext: (context) => wrapLogger(pinoLogger.child({
102
- domain: context.domain,
103
- correlation_id: context.correlationId,
104
- user_id: context.userId,
105
- tenant_id: context.tenantId,
106
- })),
107
- child: (bindings) => wrapLogger(pinoLogger.child(bindings)),
108
- isLevelEnabled: (level) => pinoLogger.isLevelEnabled(level),
191
+ trace: createLogMethod(pinoLogger, 'trace'),
192
+ debug: createLogMethod(pinoLogger, 'debug'),
193
+ info: createLogMethod(pinoLogger, 'info'),
194
+ warn: createLogMethod(pinoLogger, 'warn'),
195
+ error: createLogMethod(pinoLogger, 'error'),
196
+ fatal: createLogMethod(pinoLogger, 'fatal'),
197
+ domain(name) {
198
+ return wrapLogger(pinoLogger.child({ domain: name }), state);
199
+ },
200
+ withContext(context) {
201
+ return wrapLogger(pinoLogger.child({
202
+ domain: context.domain,
203
+ correlation_id: context.correlationId,
204
+ user_id: context.userId,
205
+ tenant_id: context.tenantId,
206
+ }), state);
207
+ },
208
+ child(bindings) {
209
+ return wrapLogger(pinoLogger.child(bindings), state);
210
+ },
211
+ isLevelEnabled(level) {
212
+ return pinoLogger.isLevelEnabled(level);
213
+ },
109
214
  get level() {
110
215
  return pinoLogger.level;
111
216
  },
112
- set level(lvl) {
113
- pinoLogger.level = lvl;
217
+ set level(newLevel) {
218
+ pinoLogger.level = newLevel;
219
+ },
220
+ flush() {
221
+ // No-op conditions (early return):
222
+ // 1. Pretty mode: uses worker thread transport without flushSync()
223
+ // 2. No destination: nothing to flush
224
+ // 3. Sync mode: writes are immediate, no buffering
225
+ // 4. No buffering enabled: minLength === 0 means no buffer
226
+ if (state.isPrettyMode || !state.destination || !state.isAsync) {
227
+ return;
228
+ }
229
+ // Check if buffering is actually enabled (minLength > 0)
230
+ // When minLength is 0, writes go directly to fd without buffering
231
+ if (state.destination.minLength === 0) {
232
+ return;
233
+ }
234
+ try {
235
+ state.destination.flushSync();
236
+ }
237
+ catch (err) {
238
+ // flushSync can throw if the stream is already closed or under extreme backpressure
239
+ // Log to stderr as a warning - this is a best-effort operation
240
+ console.error('[@arivlabs/logger] flushSync failed (buffer may not have been flushed):', err instanceof Error ? err.message : String(err));
241
+ }
242
+ },
243
+ async shutdown() {
244
+ // Clean up exception handlers first to prevent logging during shutdown
245
+ if (state.cleanupHandlers) {
246
+ state.cleanupHandlers();
247
+ }
248
+ // Only process destination shutdown for non-pretty mode
249
+ if (state.destination && !state.isPrettyMode) {
250
+ const dest = state.destination;
251
+ // Step 1: Synchronously flush current buffer
252
+ try {
253
+ dest.flushSync();
254
+ }
255
+ catch {
256
+ // Ignore flush errors during shutdown
257
+ }
258
+ // Step 2: End the stream and wait for completion
259
+ await new Promise((resolve) => {
260
+ const timeoutMs = 5000; // 5 second timeout for safety
261
+ const timeout = setTimeout(() => {
262
+ // Force resolve if end() takes too long
263
+ resolve();
264
+ }, timeoutMs);
265
+ // Use async flush if available, then end
266
+ // In pino v10+, flush() may not be available on all destinations
267
+ if (typeof dest.flush === 'function') {
268
+ dest.flush(() => {
269
+ dest.end(() => {
270
+ clearTimeout(timeout);
271
+ resolve();
272
+ });
273
+ });
274
+ }
275
+ else {
276
+ // Fallback: just call end() directly
277
+ dest.end(() => {
278
+ clearTimeout(timeout);
279
+ resolve();
280
+ });
281
+ }
282
+ });
283
+ }
284
+ },
285
+ getBufferMetrics() {
286
+ const baseMetrics = {
287
+ isAsync: state.isAsync,
288
+ isPrettyMode: state.isPrettyMode,
289
+ metricsAvailable: !state.isPrettyMode && state.destination !== null,
290
+ };
291
+ // Detailed metrics only available for SonicBoom destinations
292
+ if (state.destination && !state.isPrettyMode) {
293
+ const dest = state.destination;
294
+ return {
295
+ ...baseMetrics,
296
+ // writableNeedDrain indicates the stream is experiencing backpressure
297
+ // This is a standard Node.js stream property that SonicBoom inherits
298
+ isBackpressured: dest.writableNeedDrain ?? false,
299
+ isDestroyed: dest.destroyed,
300
+ };
301
+ }
302
+ return baseMetrics;
303
+ },
304
+ get pino() {
305
+ return pinoLogger;
114
306
  },
115
307
  };
116
308
  return wrapped;
117
309
  }
310
+ // =============================================================================
311
+ // PUBLIC API
312
+ // =============================================================================
118
313
  /**
119
- * Create a structured logger for an ArivLabs service
120
- *
121
- * Supports flexible calling conventions:
122
- * - Intuitive style: `logger.info('Message', { key: value })`
123
- * - Pino native style: `logger.info({ msg: 'Message', key: value })`
314
+ * Create a structured logger for a service.
124
315
  *
125
316
  * @example
126
317
  * ```typescript
127
- * import { createLogger } from '@arivlabs/logger';
128
- *
129
- * const logger = createLogger({ service: 'api-gateway' });
130
- *
131
- * // Basic logging (intuitive style - recommended)
318
+ * // Basic usage
319
+ * const logger = createLogger({ service: 'my-service' });
132
320
  * logger.info('Server started', { port: 3000 });
133
321
  *
134
- * // Error logging - both { err } and { error } work
135
- * logger.error('Request failed', { err: error }); // ✅ Works
136
- * logger.error('Request failed', { error: error }); // ✅ Also works
137
- * logger.error('Request failed', { error: err.message }); // ❌ Bad - pass Error object
138
- *
139
- * // Also works: pino native style
140
- * logger.info({ msg: 'Server started', port: 3000 });
141
- *
142
322
  * // Domain-specific logging
143
- * const discoveryLog = logger.domain('discovery');
144
- * discoveryLog.info('Job created', { jobId: '123' });
323
+ * const authLog = logger.domain('auth');
324
+ * authLog.info('User logged in', { userId: '123' });
145
325
  *
146
326
  * // Request context logging
147
327
  * const reqLog = logger.withContext({
@@ -149,32 +329,48 @@ function wrapLogger(pinoLogger) {
149
329
  * tenantId: 'tenant-1',
150
330
  * domain: 'discovery'
151
331
  * });
152
- * reqLog.info('Processing request');
332
+ *
333
+ * // Error logging - both { err } and { error } work
334
+ * logger.error('Request failed', { err: error });
335
+ * logger.error('Request failed', { error }); // Auto-converted
336
+ *
337
+ * // IMPORTANT: Graceful shutdown (required for async mode)
338
+ * process.on('SIGTERM', async () => {
339
+ * await logger.shutdown();
340
+ * process.exit(0);
341
+ * });
153
342
  * ```
154
343
  *
155
344
  * CloudWatch Insights queries:
156
- * - Filter by service: `fields @timestamp, @message | filter service = "api-gateway"`
157
- * - Filter by domain: `fields @timestamp, @message | filter domain = "discovery"`
158
- * - Filter errors: `fields @timestamp, @message | filter level = "error"`
159
- * - Filter by tenant: `fields @timestamp, @message | filter tenant_id = "xxx"`
345
+ * - Filter by service: `filter service = "my-service"`
346
+ * - Filter by domain: `filter domain = "auth"`
347
+ * - Filter errors: `filter level >= 50`
348
+ * - Filter by tenant: `filter tenant_id = "xxx"`
160
349
  */
161
350
  function createLogger(config) {
162
- const isDevelopment = config.environment === 'development' || process.env.NODE_ENV === 'development';
351
+ const environment = config.environment || process.env.ENV || process.env.NODE_ENV || 'development';
352
+ const isDevelopment = environment === 'development';
163
353
  const isLocal = process.env.ENV === 'local';
354
+ const isTest = environment === 'test' || process.env.NODE_ENV === 'test';
164
355
  const shouldPrettyPrint = config.pretty ?? (isDevelopment || isLocal);
356
+ // Async defaults: enabled in production, disabled in dev/test for simplicity
357
+ const useAsync = config.enableAsync ?? (!isDevelopment && !isLocal && !isTest);
165
358
  // Build redact paths: defaults + custom
166
- const redactPaths = [...exports.DEFAULT_REDACT_PATHS, ...(config.redact?.paths || [])];
167
- const pinoOptions = {
359
+ const redactPaths = [...exports.DEFAULT_REDACT_PATHS, ...(config.redact?.paths ?? [])];
360
+ // Base pino options
361
+ const basePinoOptions = {
168
362
  name: config.service,
169
363
  level: config.level || process.env.LOG_LEVEL || (isDevelopment ? 'debug' : 'info'),
170
364
  // Base fields included in every log
171
365
  base: {
172
366
  service: config.service,
173
- environment: config.environment || process.env.ENV || process.env.NODE_ENV || 'development',
367
+ environment,
368
+ ...config.base,
174
369
  },
175
- // Timestamp format (CloudWatch-friendly ISO 8601)
176
- timestamp: () => `,"timestamp":"${new Date().toISOString()}"`,
177
- // Redact sensitive fields (masks by default, can be configured to remove)
370
+ // Timestamp in ISO 8601 format (e.g. "2025-01-30T14:00:00.000Z")
371
+ // Uses pino's built-in for optimal performance. Field name is "time".
372
+ timestamp: pino_1.stdTimeFunctions.isoTime,
373
+ // Redact sensitive fields
178
374
  redact: {
179
375
  paths: redactPaths,
180
376
  censor: config.redact?.censor ?? '[REDACTED]',
@@ -187,31 +383,145 @@ function createLogger(config) {
187
383
  err: pino_1.default.stdSerializers.err,
188
384
  },
189
385
  };
190
- // Add pretty printing for development
386
+ // Initialize state
387
+ const state = {
388
+ destination: null,
389
+ isAsync: useAsync,
390
+ isPrettyMode: shouldPrettyPrint,
391
+ pinoLogger: null, // Will be set below
392
+ };
393
+ let pinoLogger;
191
394
  if (shouldPrettyPrint) {
192
- pinoOptions.transport = {
193
- target: 'pino-pretty',
194
- options: {
195
- colorize: true,
196
- translateTime: 'HH:MM:ss Z',
197
- ignore: 'pid,hostname',
198
- messageFormat: '[{service}:{domain}] {correlation_id} {msg}',
395
+ // Pretty printing for development - uses pino-pretty transport
396
+ // IMPORTANT: Transports run in worker threads, which means:
397
+ // - flushSync() is not available (flush() is a no-op)
398
+ // - pino.final() cannot be used for crash-safe logging
399
+ // - Logs may be lost if process exits abruptly
400
+ const pinoOptions = {
401
+ ...basePinoOptions,
402
+ transport: {
403
+ target: 'pino-pretty',
404
+ options: {
405
+ colorize: true,
406
+ translateTime: 'HH:MM:ss Z',
407
+ ignore: 'pid,hostname',
408
+ messageFormat: '[{service}:{domain}] {correlation_id} {msg}',
409
+ },
199
410
  },
200
411
  };
412
+ pinoLogger = (0, pino_1.default)(pinoOptions);
413
+ state.isAsync = false; // Transport handles its own buffering
414
+ }
415
+ else {
416
+ // Production mode - use SonicBoom destination
417
+ // This provides:
418
+ // - Buffered async writes (high performance)
419
+ // - flushSync() for crash-safe logging (best-effort)
420
+ //
421
+ // Note: pino.final() was deprecated in Node 14+ and removed in pino v10.
422
+ // We use direct flushSync() calls instead for crash-safe logging.
423
+ // pino.destination() returns a SonicBoom instance
424
+ const rawDestination = pino_1.default.destination({
425
+ sync: !useAsync,
426
+ minLength: useAsync ? (config.asyncBufferSize ?? 4096) : 0,
427
+ });
428
+ // Validate the destination has the expected SonicBoom interface
429
+ if (isSonicBoomDestination(rawDestination)) {
430
+ state.destination = rawDestination;
431
+ }
432
+ else {
433
+ // Fallback: destination doesn't have expected methods, disable crash-safe features
434
+ // This should never happen with standard pino, but provides runtime safety
435
+ console.warn('[@arivlabs/logger] Unexpected pino destination type. ' +
436
+ 'Crash-safe logging (flushSync) will be unavailable.');
437
+ state.destination = null;
438
+ }
439
+ pinoLogger = (0, pino_1.default)(basePinoOptions, rawDestination);
440
+ }
441
+ state.pinoLogger = pinoLogger;
442
+ // Register exception handlers if requested (opt-in)
443
+ if (config.handleExceptions && !isTest) {
444
+ const shouldExit = config.exitOnFatal !== false; // Default to true for backward compat
445
+ if (state.destination && !shouldPrettyPrint) {
446
+ // Production mode: Use synchronous flush for crash-safe logging
447
+ // This is the pino v10+ recommended pattern (pino.final was removed)
448
+ //
449
+ // IMPORTANT: flushSync() is best-effort. Under extreme conditions
450
+ // (SIGKILL, OOM, system crash, extreme backpressure), logs may still be lost.
451
+ const crashSafeHandler = (err, eventName) => {
452
+ // Log the fatal error
453
+ pinoLogger.fatal({ err, event: eventName }, 'Process terminating due to error');
454
+ // Synchronously flush to ensure the log is written before exit
455
+ // This blocks until the buffer is flushed to the underlying fd
456
+ try {
457
+ state.destination.flushSync();
458
+ }
459
+ catch {
460
+ // flushSync can throw if stream is destroyed - ignore during crash
461
+ }
462
+ if (shouldExit) {
463
+ process.exit(1);
464
+ }
465
+ };
466
+ const uncaughtHandler = (err) => {
467
+ crashSafeHandler(err, 'uncaughtException');
468
+ };
469
+ const rejectionHandler = (reason) => {
470
+ const err = reason instanceof Error ? reason : new Error(String(reason));
471
+ crashSafeHandler(err, 'unhandledRejection');
472
+ };
473
+ process.on('uncaughtException', uncaughtHandler);
474
+ process.on('unhandledRejection', rejectionHandler);
475
+ // Store cleanup function
476
+ state.cleanupHandlers = () => {
477
+ process.removeListener('uncaughtException', uncaughtHandler);
478
+ process.removeListener('unhandledRejection', rejectionHandler);
479
+ };
480
+ }
481
+ else {
482
+ // Pretty mode (development): Best-effort handler
483
+ // WARNING: Logs may not be delivered if process exits immediately
484
+ // Worker thread transports don't expose flushSync()
485
+ const bestEffortHandler = (err, eventName) => {
486
+ // Best effort logging - may not complete before exit in pretty mode
487
+ pinoLogger.fatal({ err, event: eventName }, 'Process terminating due to error');
488
+ if (shouldExit) {
489
+ // Small delay to allow log to be processed by transport worker
490
+ // This is NOT guaranteed - just gives the worker a chance
491
+ setTimeout(() => process.exit(1), 100);
492
+ }
493
+ };
494
+ const uncaughtHandler = (err) => {
495
+ bestEffortHandler(err, 'uncaughtException');
496
+ };
497
+ const rejectionHandler = (reason) => {
498
+ const err = reason instanceof Error ? reason : new Error(String(reason));
499
+ bestEffortHandler(err, 'unhandledRejection');
500
+ };
501
+ process.on('uncaughtException', uncaughtHandler);
502
+ process.on('unhandledRejection', rejectionHandler);
503
+ // Store cleanup function
504
+ state.cleanupHandlers = () => {
505
+ process.removeListener('uncaughtException', uncaughtHandler);
506
+ process.removeListener('unhandledRejection', rejectionHandler);
507
+ };
508
+ }
201
509
  }
202
- const baseLogger = (0, pino_1.default)(pinoOptions);
203
- return wrapLogger(baseLogger);
510
+ return wrapLogger(pinoLogger, state);
204
511
  }
512
+ // =============================================================================
513
+ // CONVENIENCE EXPORTS (deprecated but maintained for migration)
514
+ // =============================================================================
205
515
  /**
206
- * Create a domain-specific child logger
207
- * @deprecated Use logger.domain() instead
516
+ * Create a domain-specific child logger.
517
+ * @deprecated Use `logger.domain(name)` instead.
208
518
  */
209
519
  function createDomainLogger(logger, domain) {
210
520
  return logger.domain(domain);
211
521
  }
212
522
  /**
213
- * Create a child logger with request context
214
- * @deprecated Use logger.withContext() instead
523
+ * Create a child logger with request context.
524
+ * @deprecated Use `logger.withContext()` instead.
215
525
  */
216
526
  function createRequestLogger(logger, domain, correlationId, userId, tenantId) {
217
527
  return logger.withContext({
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AA8SA,oCAqDC;AAMD,gDAEC;AAMD,kDAaC;AA7XD,gDAAwB;AAqDxB;;;GAGG;AACU,QAAA,oBAAoB,GAAG;IAClC,2BAA2B;IAC3B,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;IACf,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,mBAAmB;IAC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