@eventuras/logger 0.7.1 → 0.8.1

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 CHANGED
@@ -20,7 +20,12 @@ pnpm add @eventuras/logger
20
20
 
21
21
  ## Quick Start
22
22
 
23
- ### Scoped Logger (recommended)
23
+ ### Scoped Logger (preferred)
24
+
25
+ Create a `Logger` instance per module so every log entry carries the
26
+ module's namespace and any persistent context — it's the pattern we
27
+ use everywhere in Eventuras, and it makes filtering by module in Loki
28
+ / Grafana trivial.
24
29
 
25
30
  ```typescript
26
31
  import { Logger } from "@eventuras/logger";
@@ -36,6 +41,11 @@ logger.error({ error }, "Failed to save event");
36
41
 
37
42
  ### Static Methods (one-off logs)
38
43
 
44
+ The static methods are fine for bootstrap code that runs before any
45
+ scoped logger exists (server startup, top-level error handlers,
46
+ scripts). For anything inside a module or request path, prefer
47
+ `Logger.create()` so the output stays namespaced.
48
+
39
49
  ```typescript
40
50
  import { Logger } from "@eventuras/logger";
41
51
 
@@ -66,17 +76,30 @@ import { Logger } from "@eventuras/logger";
66
76
 
67
77
  Logger.configure({
68
78
  level: "debug",
69
- prettyPrint: process.env.NODE_ENV === "development",
70
79
  redact: ["password", "token", "apiKey", "authorization", "secret"],
71
80
  destination: "/var/log/app.log", // Optional file output
72
81
  });
73
82
  ```
74
83
 
84
+ ### Pretty dev output (Node only)
85
+
86
+ Pretty-printing depends on `node:stream`, so it lives in the `/node`
87
+ subpath to keep the main entry browser/edge-safe. Call it from your
88
+ server bootstrap:
89
+
90
+ ```typescript
91
+ import { configureNodeLogger } from "@eventuras/logger/node";
92
+
93
+ configureNodeLogger({
94
+ level: "debug",
95
+ prettyPrint: process.env.NODE_ENV === "development",
96
+ });
97
+ ```
98
+
75
99
  ### Environment Variables
76
100
 
77
101
  ```bash
78
- LOG_LEVEL=debug # Set global log level
79
- NODE_ENV=development # Enables pretty printing
102
+ LOG_LEVEL=debug # Set global log level (picked up by the default PinoTransport)
80
103
  ```
81
104
 
82
105
  ## Transports
@@ -99,16 +122,20 @@ interface LogTransport {
99
122
  ```typescript
100
123
  import { Logger, PinoTransport } from "@eventuras/logger";
101
124
 
102
- // Explicit Pino configuration
125
+ // Explicit Pino configuration (JSON output to stdout)
103
126
  Logger.configure({
104
127
  transport: new PinoTransport({
105
128
  level: "debug",
106
- prettyPrint: true,
107
129
  redact: ["password", "secret"],
108
130
  }),
109
131
  });
110
132
  ```
111
133
 
134
+ For pretty-printed dev output, use `configureNodeLogger` from
135
+ `@eventuras/logger/node` (see [Pretty dev output](#pretty-dev-output-node-only))
136
+ — the `prettyPrint` option lives there to keep `node:stream` out of the
137
+ universal main entry.
138
+
112
139
  ### ConsoleTransport
113
140
 
114
141
  A lightweight transport using native `console` methods. Automatically selected as the default in browser and edge runtimes. Also useful for testing:
@@ -147,6 +174,9 @@ Logger.configure({ transport: new DatadogTransport() });
147
174
  Sensitive fields are automatically redacted:
148
175
 
149
176
  ```typescript
177
+ import { Logger } from "@eventuras/logger";
178
+ const logger = Logger.create({ namespace: "auth" });
179
+
150
180
  logger.info(
151
181
  {
152
182
  username: "john",
@@ -161,6 +191,34 @@ Default redacted paths: `password`, `token`, `apiKey`, `authorization`, `secret`
161
191
 
162
192
  Configure additional paths via `Logger.configure({ redact: [...] })`.
163
193
 
194
+ ### Nested fields
195
+
196
+ Redaction uses [Pino's `redact` option](https://getpino.io/#/docs/redaction), which is powered by [fast-redact](https://github.com/davidmarkclements/fast-redact). Paths are **exact field paths** — they don't match nested occurrences by default:
197
+
198
+ ```typescript
199
+ // Only redacts top-level `password`
200
+ Logger.configure({ redact: ["password"] });
201
+
202
+ const logger = Logger.create({ namespace: "auth" });
203
+ logger.info({ password: "x" }); // → [REDACTED]
204
+ logger.info({ user: { password: "x" } }); // → NOT redacted
205
+ ```
206
+
207
+ To redact nested fields, spell out the path or use wildcards:
208
+
209
+ ```typescript
210
+ Logger.configure({
211
+ redact: [
212
+ "password",
213
+ "user.password",
214
+ "request.headers.authorization",
215
+ "*.token", // any key named `token` one level deep
216
+ ],
217
+ });
218
+ ```
219
+
220
+ For HTTP headers specifically, prefer [`redactHeaders`](#http-header-redaction) — it normalizes the object and handles `Headers` instances in addition to plain objects.
221
+
164
222
  ## HTTP Header Redaction
165
223
 
166
224
  Utility for redacting sensitive HTTP headers:
@@ -215,7 +273,7 @@ process.on("SIGTERM", async () => {
215
273
  });
216
274
  ```
217
275
 
218
- ### Environment Variables
276
+ ### OTel Environment Variables
219
277
 
220
278
  ```bash
221
279
  OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://...
@@ -290,11 +348,11 @@ import type {
290
348
 
291
349
  ## Subpath Exports
292
350
 
293
- | Import path | Contents | Environment |
294
- | --------------------------------- | --------------------------------------------------------------- | ----------- |
295
- | `@eventuras/logger` | Logger, types, PinoTransport, ConsoleTransport, httpLogger | Universal |
296
- | `@eventuras/logger/node` | `formatLogLine`, `createPrettyStream` (depends on `node:stream`) | Node.js |
297
- | `@eventuras/logger/opentelemetry` | `setupOpenTelemetryLogger`, `shutdownOpenTelemetryLogger` | Node.js |
351
+ | Import path | Contents | Environment |
352
+ | --- | --- | --- |
353
+ | `@eventuras/logger` | `Logger`, types, `PinoTransport`, `ConsoleTransport`, `redactHeaders` | Universal |
354
+ | `@eventuras/logger/node` | `configureNodeLogger`, `createPrettyStream`, `formatLogLine` | Node.js |
355
+ | `@eventuras/logger/opentelemetry` | `setupOpenTelemetryLogger`, `shutdownOpenTelemetryLogger` | Node.js |
298
356
 
299
357
  ### Node-only Pretty-print Utilities
300
358
 
@@ -0,0 +1,314 @@
1
+ import pino from "pino";
2
+ //#region src/transports/pino.ts
3
+ /**
4
+ * Pino-based transport — the default production backend.
5
+ *
6
+ * Wraps a Pino logger instance to satisfy the `LogTransport` interface,
7
+ * keeping Pino as an implementation detail that consumers never interact with directly.
8
+ *
9
+ * For pretty-printed dev output, see `configureNodeLogger` in
10
+ * `@eventuras/logger/node` — this module intentionally stays free of
11
+ * `node:stream` imports so the main entry stays browser/edge-safe.
12
+ */
13
+ var PinoTransport = class {
14
+ /** The underlying Pino instance. Exposed for advanced integrations only. */
15
+ pino;
16
+ constructor(options = {}) {
17
+ const pinoOpts = {
18
+ level: options.level ?? "info",
19
+ timestamp: pino.stdTimeFunctions.isoTime,
20
+ formatters: { level: (label) => ({ level: label }) },
21
+ ...options.redact && { redact: {
22
+ paths: options.redact,
23
+ censor: "[REDACTED]"
24
+ } },
25
+ ...options.pinoOptions
26
+ };
27
+ if (options.destinationStream) this.pino = pino(pinoOpts, options.destinationStream);
28
+ else if (options.destination) this.pino = pino(pinoOpts, pino.destination(options.destination));
29
+ else this.pino = pino(pinoOpts);
30
+ }
31
+ log(level, data, msg) {
32
+ if (msg) this.pino[level](data, msg);
33
+ else this.pino[level](data);
34
+ }
35
+ child(bindings) {
36
+ return new PinoChildTransport(this.pino.child(bindings));
37
+ }
38
+ async flush() {
39
+ this.pino.flush();
40
+ }
41
+ };
42
+ /**
43
+ * Lightweight wrapper for a Pino child logger.
44
+ * Created by `PinoTransport.child()` — not intended for direct use.
45
+ */
46
+ var PinoChildTransport = class PinoChildTransport {
47
+ constructor(pinoChild) {
48
+ this.pinoChild = pinoChild;
49
+ }
50
+ log(level, data, msg) {
51
+ if (msg) this.pinoChild[level](data, msg);
52
+ else this.pinoChild[level](data);
53
+ }
54
+ child(bindings) {
55
+ return new PinoChildTransport(this.pinoChild.child(bindings));
56
+ }
57
+ async flush() {
58
+ this.pinoChild.flush();
59
+ }
60
+ };
61
+ //#endregion
62
+ //#region src/transports/console.ts
63
+ var LEVEL_TO_CONSOLE = {
64
+ trace: "debug",
65
+ debug: "debug",
66
+ info: "log",
67
+ warn: "warn",
68
+ error: "error",
69
+ fatal: "error"
70
+ };
71
+ var ConsoleTransport = class ConsoleTransport {
72
+ bindings;
73
+ /** Create a ConsoleTransport with optional pre-bound context fields. */
74
+ constructor(bindings) {
75
+ this.bindings = bindings ?? {};
76
+ }
77
+ /** Write a log entry to the appropriate `console` method. */
78
+ log(level, data, msg) {
79
+ const method = LEVEL_TO_CONSOLE[level];
80
+ const merged = {
81
+ ...this.bindings,
82
+ ...data
83
+ };
84
+ const hasData = Object.keys(merged).length > 0;
85
+ if (msg && hasData) console[method](`[${level}]`, msg, merged);
86
+ else if (msg) console[method](`[${level}]`, msg);
87
+ else if (hasData) console[method](`[${level}]`, merged);
88
+ }
89
+ /** Return a new ConsoleTransport with the given bindings merged in. */
90
+ child(bindings) {
91
+ return new ConsoleTransport({
92
+ ...this.bindings,
93
+ ...bindings
94
+ });
95
+ }
96
+ };
97
+ //#endregion
98
+ //#region src/Logger.ts
99
+ var DEFAULT_REDACT = [
100
+ "password",
101
+ "token",
102
+ "apiKey",
103
+ "authorization",
104
+ "secret"
105
+ ];
106
+ function getEnv(key) {
107
+ if (typeof globalThis !== "undefined" && typeof globalThis.process === "object") return globalThis.process.env[key];
108
+ }
109
+ /** Detect Node.js runtime (vs browser / edge). */
110
+ function isNodeRuntime() {
111
+ try {
112
+ return typeof process !== "undefined" && typeof process.versions?.node === "string";
113
+ } catch {
114
+ return false;
115
+ }
116
+ }
117
+ function createDefaultTransport(config) {
118
+ if (!isNodeRuntime()) return new ConsoleTransport();
119
+ return new PinoTransport({
120
+ level: config.level ?? getEnv("LOG_LEVEL") ?? "info",
121
+ redact: config.redact ?? DEFAULT_REDACT,
122
+ destination: config.destination
123
+ });
124
+ }
125
+ var Logger = class Logger {
126
+ static transport;
127
+ static config = {};
128
+ options;
129
+ childTransport;
130
+ static {
131
+ Logger.transport = createDefaultTransport(Logger.config);
132
+ }
133
+ constructor(options = {}) {
134
+ this.options = options;
135
+ if (options.context || options.correlationId || options.namespace) {
136
+ const bindings = {
137
+ ...options.namespace && { namespace: options.namespace },
138
+ ...options.correlationId && { correlationId: options.correlationId },
139
+ ...options.context
140
+ };
141
+ this.childTransport = Logger.transport.child(bindings);
142
+ }
143
+ }
144
+ /**
145
+ * Configure global logger settings. Call once at application startup.
146
+ *
147
+ * Supply a custom `transport` to replace the default Pino backend,
148
+ * or omit it to keep PinoTransport with the provided options.
149
+ *
150
+ * @example
151
+ * Logger.configure({ level: 'debug', redact: ['password', 'apiKey'] });
152
+ *
153
+ * @example
154
+ * import { ConsoleTransport } from '@eventuras/logger';
155
+ * Logger.configure({ transport: new ConsoleTransport() });
156
+ */
157
+ static configure(config) {
158
+ Logger.config = {
159
+ ...Logger.config,
160
+ ...config
161
+ };
162
+ Logger.transport = Logger.config.transport ?? createDefaultTransport(Logger.config);
163
+ }
164
+ /**
165
+ * Get the active transport for advanced integrations.
166
+ *
167
+ * If you need access to the underlying Pino instance (e.g. for OTel
168
+ * instrumentation), check `transport instanceof PinoTransport` and
169
+ * access `.pino` on it.
170
+ */
171
+ static getTransport() {
172
+ return Logger.transport;
173
+ }
174
+ /**
175
+ * @deprecated Since 0.7 — will be removed in 1.0. Use `Logger.getTransport()`
176
+ * instead. If you need the raw Pino instance, cast the transport:
177
+ * `(Logger.getTransport() as PinoTransport).pino`.
178
+ */
179
+ static getPinoInstance() {
180
+ if (Logger.transport instanceof PinoTransport) return Logger.transport.pino;
181
+ throw new Error("getPinoInstance() requires PinoTransport. Use Logger.getTransport() for the active transport.");
182
+ }
183
+ /**
184
+ * Normalize arguments for static log methods.
185
+ * Supports both `Logger.info('msg')` and `Logger.info({ namespace: 'x' }, 'msg')`.
186
+ */
187
+ static normalizeArgs(optionsOrMsg, rest) {
188
+ if (typeof optionsOrMsg === "string") return [{}, [optionsOrMsg, ...rest]];
189
+ return [optionsOrMsg, rest];
190
+ }
191
+ static isDevelopment() {
192
+ return getEnv("NODE_ENV") === "development";
193
+ }
194
+ static formatError(error) {
195
+ if (error instanceof Error) return `${error.name}: ${error.message}\nStack: ${error.stack}`;
196
+ return String(error);
197
+ }
198
+ static buildLogData(options) {
199
+ return {
200
+ ...options.namespace && { namespace: options.namespace },
201
+ ...options.correlationId && { correlationId: options.correlationId },
202
+ ...options.context
203
+ };
204
+ }
205
+ static staticLog(level, options, ...msg) {
206
+ if (options.developerOnly && !Logger.isDevelopment()) return;
207
+ const data = Logger.buildLogData(options);
208
+ Logger.transport.log(level, {
209
+ ...data,
210
+ msg
211
+ });
212
+ }
213
+ static staticErrorLog(level, options, ...msg) {
214
+ if (options.developerOnly && !Logger.isDevelopment()) return;
215
+ const errorInfo = options.error ? { error: Logger.formatError(options.error) } : {};
216
+ const data = {
217
+ ...Logger.buildLogData(options),
218
+ ...errorInfo
219
+ };
220
+ Logger.transport.log(level, {
221
+ ...data,
222
+ msg
223
+ });
224
+ }
225
+ static info(optionsOrMsg, ...msg) {
226
+ const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);
227
+ Logger.staticLog("info", options, ...messages);
228
+ }
229
+ static debug(optionsOrMsg, ...msg) {
230
+ const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);
231
+ Logger.staticLog("debug", options, ...messages);
232
+ }
233
+ static trace(optionsOrMsg, ...msg) {
234
+ const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);
235
+ Logger.staticLog("trace", options, ...messages);
236
+ }
237
+ static warn(optionsOrMsg, ...msg) {
238
+ const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);
239
+ Logger.staticLog("warn", options, ...messages);
240
+ }
241
+ static error(optionsOrMsg, ...msg) {
242
+ const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);
243
+ Logger.staticErrorLog("error", options, ...messages);
244
+ }
245
+ static fatal(optionsOrMsg, ...msg) {
246
+ const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);
247
+ Logger.staticErrorLog("fatal", options, ...messages);
248
+ }
249
+ /**
250
+ * Create a scoped logger instance with predefined options.
251
+ *
252
+ * @example
253
+ * const logger = Logger.create({ namespace: 'CollectionEditor' });
254
+ * logger.info('Something happened');
255
+ *
256
+ * @example
257
+ * const logger = Logger.create({
258
+ * namespace: 'API',
259
+ * context: { userId: 123 },
260
+ * correlationId: req.headers['x-correlation-id'],
261
+ * });
262
+ * logger.info({ eventId: 789 }, 'Event added');
263
+ */
264
+ static create(options = {}) {
265
+ return new Logger(options);
266
+ }
267
+ logInstance(level, data, msg) {
268
+ const transport = this.childTransport ?? Logger.transport;
269
+ if (typeof data === "string") transport.log(level, {}, data);
270
+ else if (msg) transport.log(level, data ?? {}, msg);
271
+ else transport.log(level, data ?? {});
272
+ }
273
+ /** Log at `trace` level. Pass a string or `{ data }` with an optional message. */
274
+ trace(data, msg) {
275
+ this.logInstance("trace", data, msg);
276
+ }
277
+ /** Log at `debug` level. */
278
+ debug(data, msg) {
279
+ this.logInstance("debug", data, msg);
280
+ }
281
+ /** Log at `info` level. */
282
+ info(data, msg) {
283
+ this.logInstance("info", data, msg);
284
+ }
285
+ /** Log at `warn` level. */
286
+ warn(data, msg) {
287
+ this.logInstance("warn", data, msg);
288
+ }
289
+ /**
290
+ * Log at `error` level. Accepts an `Error` instance, a data object, or a plain string.
291
+ * Error instances are serialized automatically.
292
+ */
293
+ error(errorOrData, msg) {
294
+ const transport = this.childTransport ?? Logger.transport;
295
+ if (typeof errorOrData === "string") transport.log("error", {}, errorOrData);
296
+ else if (errorOrData instanceof Error) transport.log("error", { error: errorOrData }, msg);
297
+ else if (msg) transport.log("error", errorOrData ?? {}, msg);
298
+ else transport.log("error", errorOrData ?? {});
299
+ }
300
+ /**
301
+ * Log at `fatal` level. Same signature as `error()` but signals a critical/shutdown failure.
302
+ */
303
+ fatal(errorOrData, msg) {
304
+ const transport = this.childTransport ?? Logger.transport;
305
+ if (typeof errorOrData === "string") transport.log("fatal", {}, errorOrData);
306
+ else if (errorOrData instanceof Error) transport.log("fatal", { error: errorOrData }, msg);
307
+ else if (msg) transport.log("fatal", errorOrData ?? {}, msg);
308
+ else transport.log("fatal", errorOrData ?? {});
309
+ }
310
+ };
311
+ //#endregion
312
+ export { ConsoleTransport as n, PinoTransport as r, Logger as t };
313
+
314
+ //# sourceMappingURL=Logger-n-HsscG5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger-n-HsscG5.js","names":[],"sources":["../src/transports/pino.ts","../src/transports/console.ts","../src/Logger.ts"],"sourcesContent":["/**\n * Pino-based transport — the default production backend.\n *\n * Wraps a Pino logger instance to satisfy the `LogTransport` interface,\n * keeping Pino as an implementation detail that consumers never interact with directly.\n *\n * For pretty-printed dev output, see `configureNodeLogger` in\n * `@eventuras/logger/node` — this module intentionally stays free of\n * `node:stream` imports so the main entry stays browser/edge-safe.\n */\nimport pino, { type Logger as PinoLogger, type LoggerOptions as PinoLoggerOptions } from 'pino';\nimport type { LogLevel, LogTransport } from '../types';\n\n/**\n * Minimal structural type for a Pino destination stream — accepts anything\n * with a `write` method. Defined locally so this file (re-exported from the\n * universal `@eventuras/logger` entry) doesn't pull `NodeJS.*` types into\n * browser/edge consumers that don't ship `@types/node`.\n */\nexport interface PinoDestinationStream {\n write(chunk: string | Uint8Array): unknown;\n}\n\n/** Options for creating a PinoTransport. */\nexport type PinoTransportOptions = {\n /** Minimum log level. Defaults to `'info'`. */\n level?: LogLevel;\n /** Field paths to redact from output. */\n redact?: string[];\n /** File path destination (omit for stdout). */\n destination?: string;\n /**\n * Writable stream destination (e.g. a pretty-print stream from\n * `@eventuras/logger/node`). Takes precedence over `destination`.\n */\n destinationStream?: PinoDestinationStream;\n /** Raw Pino options for advanced tuning (merged after built-in defaults). */\n pinoOptions?: PinoLoggerOptions;\n};\n\nexport class PinoTransport implements LogTransport {\n /** The underlying Pino instance. Exposed for advanced integrations only. */\n readonly pino: PinoLogger;\n\n constructor(options: PinoTransportOptions = {}) {\n const pinoOpts: PinoLoggerOptions = {\n level: options.level ?? 'info',\n // ISO timestamps for Loki/Grafana compatibility\n timestamp: pino.stdTimeFunctions.isoTime,\n // Output level as string label — avoids numeric mapping in log pipelines\n formatters: {\n level: (label) => ({ level: label }),\n },\n ...(options.redact && {\n redact: { paths: options.redact, censor: '[REDACTED]' },\n }),\n ...options.pinoOptions,\n };\n\n if (options.destinationStream) {\n // Pino's overload expects a NodeJS.WritableStream; the structural\n // PinoDestinationStream is a strict subset (only `.write` is read at\n // runtime), so the cast is safe.\n this.pino = pino(pinoOpts, options.destinationStream as Parameters<typeof pino>[1]);\n } else if (options.destination) {\n this.pino = pino(pinoOpts, pino.destination(options.destination));\n } else {\n this.pino = pino(pinoOpts);\n }\n }\n\n log(level: LogLevel, data: Record<string, unknown>, msg?: string): void {\n if (msg) {\n this.pino[level](data, msg);\n } else {\n this.pino[level](data);\n }\n }\n\n child(bindings: Record<string, unknown>): LogTransport {\n const childPino = this.pino.child(bindings);\n return new PinoChildTransport(childPino);\n }\n\n async flush(): Promise<void> {\n this.pino.flush();\n }\n}\n\n/**\n * Lightweight wrapper for a Pino child logger.\n * Created by `PinoTransport.child()` — not intended for direct use.\n */\nclass PinoChildTransport implements LogTransport {\n constructor(private readonly pinoChild: PinoLogger) { }\n\n log(level: LogLevel, data: Record<string, unknown>, msg?: string): void {\n if (msg) {\n this.pinoChild[level](data, msg);\n } else {\n this.pinoChild[level](data);\n }\n }\n\n child(bindings: Record<string, unknown>): LogTransport {\n return new PinoChildTransport(this.pinoChild.child(bindings));\n }\n\n async flush(): Promise<void> {\n this.pinoChild.flush();\n }\n}\n","/**\n * Console-based transport for browser environments and testing.\n *\n * Uses `console.log/warn/error` — no dependencies, works everywhere.\n * Useful as a lightweight fallback when Pino is not available or desired.\n */\nimport type { LogLevel, LogTransport } from '../types';\n\nconst LEVEL_TO_CONSOLE: Record<LogLevel, 'log' | 'warn' | 'error' | 'debug'> = {\n trace: 'debug',\n debug: 'debug',\n info: 'log',\n warn: 'warn',\n error: 'error',\n fatal: 'error',\n};\n\nexport class ConsoleTransport implements LogTransport {\n private readonly bindings: Record<string, unknown>;\n\n /** Create a ConsoleTransport with optional pre-bound context fields. */\n constructor(bindings?: Record<string, unknown>) {\n this.bindings = bindings ?? {};\n }\n\n /** Write a log entry to the appropriate `console` method. */\n log(level: LogLevel, data: Record<string, unknown>, msg?: string): void {\n const method = LEVEL_TO_CONSOLE[level];\n const merged = { ...this.bindings, ...data };\n const hasData = Object.keys(merged).length > 0;\n\n if (msg && hasData) {\n console[method](`[${level}]`, msg, merged);\n } else if (msg) {\n console[method](`[${level}]`, msg);\n } else if (hasData) {\n console[method](`[${level}]`, merged);\n }\n }\n\n /** Return a new ConsoleTransport with the given bindings merged in. */\n child(bindings: Record<string, unknown>): LogTransport {\n return new ConsoleTransport({ ...this.bindings, ...bindings });\n }\n}\n","/**\n * Structured logger with pluggable transports.\n *\n * Uses a `LogTransport` abstraction so the logging backend can be swapped\n * without changing application code. Ships with PinoTransport (default,\n * production-grade) and ConsoleTransport (browser/testing).\n *\n * Standard log levels:\n * fatal: 60 | error: 50 | warn: 40 | info: 30 | debug: 20 | trace: 10\n *\n * @example\n * // Scoped logger (recommended pattern)\n * const logger = Logger.create({\n * namespace: 'CollectionEditor',\n * context: { collectionId: 123 },\n * });\n * logger.info('Event added', { eventId: 456 });\n *\n * @example\n * // Static one-off logs\n * Logger.info('Simple message');\n * Logger.error({ error: err }, 'Something failed');\n *\n * @example\n * // Custom transport\n * import { ConsoleTransport } from '@eventuras/logger';\n * Logger.configure({ transport: new ConsoleTransport() });\n */\nimport type {\n ErrorLoggerOptions,\n LoggerConfig,\n LoggerOptions,\n LogLevel,\n LogTransport,\n} from './types';\nimport { PinoTransport } from './transports/pino';\nimport { ConsoleTransport } from './transports/console';\n\nconst DEFAULT_REDACT = ['password', 'token', 'apiKey', 'authorization', 'secret'];\n\nfunction getEnv(key: string): string | undefined {\n if (typeof globalThis !== 'undefined' && typeof (globalThis as Record<string, unknown>).process === 'object') {\n return (globalThis as unknown as { process: { env: Record<string, string | undefined>; }; }).process.env[key];\n }\n return undefined;\n}\n\n/** Detect Node.js runtime (vs browser / edge). */\nfunction isNodeRuntime(): boolean {\n try {\n return typeof process !== 'undefined' && typeof process.versions?.node === 'string';\n } catch {\n return false;\n }\n}\n\nfunction createDefaultTransport(config: LoggerConfig): LogTransport {\n // In non-Node environments (browser, edge), fall back to ConsoleTransport\n if (!isNodeRuntime()) {\n return new ConsoleTransport();\n }\n\n return new PinoTransport({\n level: config.level ?? (getEnv('LOG_LEVEL') as LogLevel | undefined) ?? 'info',\n redact: config.redact ?? DEFAULT_REDACT,\n destination: config.destination,\n });\n}\n\nexport class Logger {\n private static transport: LogTransport;\n private static config: LoggerConfig = {};\n\n // Instance properties for scoped logger\n private readonly options: LoggerOptions;\n private readonly childTransport?: LogTransport;\n\n static {\n Logger.transport = createDefaultTransport(Logger.config);\n }\n\n private constructor(options: LoggerOptions = {}) {\n this.options = options;\n\n if (options.context || options.correlationId || options.namespace) {\n const bindings: Record<string, unknown> = {\n ...(options.namespace && { namespace: options.namespace }),\n ...(options.correlationId && { correlationId: options.correlationId }),\n ...options.context,\n };\n this.childTransport = Logger.transport.child(bindings);\n }\n }\n\n /**\n * Configure global logger settings. Call once at application startup.\n *\n * Supply a custom `transport` to replace the default Pino backend,\n * or omit it to keep PinoTransport with the provided options.\n *\n * @example\n * Logger.configure({ level: 'debug', redact: ['password', 'apiKey'] });\n *\n * @example\n * import { ConsoleTransport } from '@eventuras/logger';\n * Logger.configure({ transport: new ConsoleTransport() });\n */\n static configure(config: Partial<LoggerConfig>): void {\n Logger.config = { ...Logger.config, ...config };\n Logger.transport = Logger.config.transport ?? createDefaultTransport(Logger.config);\n }\n\n /**\n * Get the active transport for advanced integrations.\n *\n * If you need access to the underlying Pino instance (e.g. for OTel\n * instrumentation), check `transport instanceof PinoTransport` and\n * access `.pino` on it.\n */\n static getTransport(): LogTransport {\n return Logger.transport;\n }\n\n /**\n * @deprecated Since 0.7 — will be removed in 1.0. Use `Logger.getTransport()`\n * instead. If you need the raw Pino instance, cast the transport:\n * `(Logger.getTransport() as PinoTransport).pino`.\n */\n static getPinoInstance(): import('pino').Logger {\n if (Logger.transport instanceof PinoTransport) {\n return Logger.transport.pino;\n }\n throw new Error(\n 'getPinoInstance() requires PinoTransport. Use Logger.getTransport() for the active transport.',\n );\n }\n\n // --- Static convenience methods ---\n\n /**\n * Normalize arguments for static log methods.\n * Supports both `Logger.info('msg')` and `Logger.info({ namespace: 'x' }, 'msg')`.\n */\n private static normalizeArgs(\n optionsOrMsg: LoggerOptions | string,\n rest: unknown[],\n ): [LoggerOptions, unknown[]] {\n if (typeof optionsOrMsg === 'string') {\n return [{}, [optionsOrMsg, ...rest]];\n }\n return [optionsOrMsg, rest];\n }\n\n private static isDevelopment(): boolean {\n return getEnv('NODE_ENV') === 'development';\n }\n\n private static formatError(error: unknown): string {\n if (error instanceof Error) {\n return `${error.name}: ${error.message}\\nStack: ${error.stack}`;\n }\n return String(error);\n }\n\n private static buildLogData(options: LoggerOptions): Record<string, unknown> {\n return {\n ...(options.namespace && { namespace: options.namespace }),\n ...(options.correlationId && { correlationId: options.correlationId }),\n ...options.context,\n };\n }\n\n private static staticLog(\n level: LogLevel,\n options: LoggerOptions,\n ...msg: unknown[]\n ): void {\n if (options.developerOnly && !Logger.isDevelopment()) return;\n const data = Logger.buildLogData(options);\n Logger.transport.log(level, { ...data, msg });\n }\n\n private static staticErrorLog(\n level: LogLevel,\n options: ErrorLoggerOptions,\n ...msg: unknown[]\n ): void {\n if (options.developerOnly && !Logger.isDevelopment()) return;\n const errorInfo = options.error ? { error: Logger.formatError(options.error) } : {};\n const data = { ...Logger.buildLogData(options), ...errorInfo };\n Logger.transport.log(level, { ...data, msg });\n }\n\n /** Log at info level with options and message(s). */\n static info(options: LoggerOptions, ...msg: unknown[]): void;\n /** Log at info level with just a message string. */\n static info(msg: string, ...args: unknown[]): void;\n static info(optionsOrMsg: LoggerOptions | string, ...msg: unknown[]): void {\n const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);\n Logger.staticLog('info', options, ...messages);\n }\n\n /** Log at debug level with options and message(s). */\n static debug(options: LoggerOptions, ...msg: unknown[]): void;\n /** Log at debug level with just a message string. */\n static debug(msg: string, ...args: unknown[]): void;\n static debug(optionsOrMsg: LoggerOptions | string, ...msg: unknown[]): void {\n const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);\n Logger.staticLog('debug', options, ...messages);\n }\n\n /** Log at trace level with options and message(s). */\n static trace(options: LoggerOptions, ...msg: unknown[]): void;\n /** Log at trace level with just a message string. */\n static trace(msg: string, ...args: unknown[]): void;\n static trace(optionsOrMsg: LoggerOptions | string, ...msg: unknown[]): void {\n const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);\n Logger.staticLog('trace', options, ...messages);\n }\n\n /** Log at warn level with options and message(s). */\n static warn(options: LoggerOptions, ...msg: unknown[]): void;\n /** Log at warn level with just a message string. */\n static warn(msg: string, ...args: unknown[]): void;\n static warn(optionsOrMsg: LoggerOptions | string, ...msg: unknown[]): void {\n const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);\n Logger.staticLog('warn', options, ...messages);\n }\n\n /** Log at error level with options and message(s). */\n static error(options: ErrorLoggerOptions, ...msg: unknown[]): void;\n /** Log at error level with just a message string. */\n static error(msg: string, ...args: unknown[]): void;\n static error(optionsOrMsg: ErrorLoggerOptions | string, ...msg: unknown[]): void {\n const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);\n Logger.staticErrorLog('error', options, ...messages);\n }\n\n /** Log at fatal level with options and message(s). */\n static fatal(options: ErrorLoggerOptions, ...msg: unknown[]): void;\n /** Log at fatal level with just a message string. */\n static fatal(msg: string, ...args: unknown[]): void;\n static fatal(optionsOrMsg: ErrorLoggerOptions | string, ...msg: unknown[]): void {\n const [options, messages] = Logger.normalizeArgs(optionsOrMsg, msg);\n Logger.staticErrorLog('fatal', options, ...messages);\n }\n\n /**\n * Create a scoped logger instance with predefined options.\n *\n * @example\n * const logger = Logger.create({ namespace: 'CollectionEditor' });\n * logger.info('Something happened');\n *\n * @example\n * const logger = Logger.create({\n * namespace: 'API',\n * context: { userId: 123 },\n * correlationId: req.headers['x-correlation-id'],\n * });\n * logger.info({ eventId: 789 }, 'Event added');\n */\n static create(options: LoggerOptions = {}): Logger {\n return new Logger(options);\n }\n\n // --- Instance methods ---\n\n private logInstance(level: LogLevel, data?: Record<string, unknown> | string, msg?: string): void {\n const transport = this.childTransport ?? Logger.transport;\n if (typeof data === 'string') {\n transport.log(level, {}, data);\n } else if (msg) {\n transport.log(level, data ?? {}, msg);\n } else {\n transport.log(level, data ?? {});\n }\n }\n\n /** Log at `trace` level. Pass a string or `{ data }` with an optional message. */\n trace(data?: Record<string, unknown> | string, msg?: string): void {\n this.logInstance('trace', data, msg);\n }\n\n /** Log at `debug` level. */\n debug(data?: Record<string, unknown> | string, msg?: string): void {\n this.logInstance('debug', data, msg);\n }\n\n /** Log at `info` level. */\n info(data?: Record<string, unknown> | string, msg?: string): void {\n this.logInstance('info', data, msg);\n }\n\n /** Log at `warn` level. */\n warn(data?: Record<string, unknown> | string, msg?: string): void {\n this.logInstance('warn', data, msg);\n }\n\n /**\n * Log at `error` level. Accepts an `Error` instance, a data object, or a plain string.\n * Error instances are serialized automatically.\n */\n error(errorOrData?: unknown, msg?: string): void {\n const transport = this.childTransport ?? Logger.transport;\n if (typeof errorOrData === 'string') {\n transport.log('error', {}, errorOrData);\n } else if (errorOrData instanceof Error) {\n transport.log('error', { error: errorOrData }, msg);\n } else if (msg) {\n transport.log('error', (errorOrData as Record<string, unknown>) ?? {}, msg);\n } else {\n transport.log('error', (errorOrData as Record<string, unknown>) ?? {});\n }\n }\n\n /**\n * Log at `fatal` level. Same signature as `error()` but signals a critical/shutdown failure.\n */\n fatal(errorOrData?: unknown, msg?: string): void {\n const transport = this.childTransport ?? Logger.transport;\n if (typeof errorOrData === 'string') {\n transport.log('fatal', {}, errorOrData);\n } else if (errorOrData instanceof Error) {\n transport.log('fatal', { error: errorOrData }, msg);\n } else if (msg) {\n transport.log('fatal', (errorOrData as Record<string, unknown>) ?? {}, msg);\n } else {\n transport.log('fatal', (errorOrData as Record<string, unknown>) ?? {});\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAwCA,IAAa,gBAAb,MAAmD;;CAEjD;CAEA,YAAY,UAAgC,EAAE,EAAE;EAC9C,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C,WAAU,IAAI,OAAO,QAAQ,EAAE,CAAC;;;CAKpC,MAAM,MAAyC,KAAoB;AACjE,OAAK,YAAY,SAAS,MAAM,IAAI;;;CAItC,MAAM,MAAyC,KAAoB;AACjE,OAAK,YAAY,SAAS,MAAM,IAAI;;;CAItC,KAAK,MAAyC,KAAoB;AAChE,OAAK,YAAY,QAAQ,MAAM,IAAI;;;CAIrC,KAAK,MAAyC,KAAoB;AAChE,OAAK,YAAY,QAAQ,MAAM,IAAI;;;;;;CAOrC,MAAM,aAAuB,KAAoB;EAC/C,MAAM,YAAY,KAAK,kBAAkB,OAAO;AAChD,MAAI,OAAO,gBAAgB,SACzB,WAAU,IAAI,SAAS,EAAE,EAAE,YAAY;WAC9B,uBAAuB,MAChC,WAAU,IAAI,SAAS,EAAE,OAAO,aAAa,EAAE,IAAI;WAC1C,IACT,WAAU,IAAI,SAAU,eAA2C,EAAE,EAAE,IAAI;MAE3E,WAAU,IAAI,SAAU,eAA2C,EAAE,CAAC;;;;;CAO1E,MAAM,aAAuB,KAAoB;EAC/C,MAAM,YAAY,KAAK,kBAAkB,OAAO;AAChD,MAAI,OAAO,gBAAgB,SACzB,WAAU,IAAI,SAAS,EAAE,EAAE,YAAY;WAC9B,uBAAuB,MAChC,WAAU,IAAI,SAAS,EAAE,OAAO,aAAa,EAAE,IAAI;WAC1C,IACT,WAAU,IAAI,SAAU,eAA2C,EAAE,EAAE,IAAI;MAE3E,WAAU,IAAI,SAAU,eAA2C,EAAE,CAAC"}
package/dist/Logger.d.ts CHANGED
@@ -28,8 +28,9 @@ export declare class Logger {
28
28
  */
29
29
  static getTransport(): LogTransport;
30
30
  /**
31
- * @deprecated Use `Logger.getTransport()` instead. If you need the raw
32
- * Pino instance, cast the transport: `(Logger.getTransport() as PinoTransport).pino`
31
+ * @deprecated Since 0.7 — will be removed in 1.0. Use `Logger.getTransport()`
32
+ * instead. If you need the raw Pino instance, cast the transport:
33
+ * `(Logger.getTransport() as PinoTransport).pino`.
33
34
  */
34
35
  static getPinoInstance(): import('pino').Logger;
35
36
  /**
@@ -66,7 +67,6 @@ export declare class Logger {
66
67
  static fatal(options: ErrorLoggerOptions, ...msg: unknown[]): void;
67
68
  /** Log at fatal level with just a message string. */
68
69
  static fatal(msg: string, ...args: unknown[]): void;
69
- private static rebindStaticMethods;
70
70
  /**
71
71
  * Create a scoped logger instance with predefined options.
72
72
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../src/Logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,aAAa,EAEb,YAAY,EACb,MAAM,SAAS,CAAC;AAoCjB,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAe;IACvC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAoB;IAGzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAe;IAM/C,OAAO;IAaP;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI;IAOrD;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,IAAI,YAAY;IAInC;;;OAGG;IACH,MAAM,CAAC,eAAe,IAAI,OAAO,MAAM,EAAE,MAAM;IAW/C;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAU5B,OAAO,CAAC,MAAM,CAAC,aAAa;IAI5B,OAAO,CAAC,MAAM,CAAC,WAAW;IAO1B,OAAO,CAAC,MAAM,CAAC,YAAY;IAQ3B,OAAO,CAAC,MAAM,CAAC,SAAS;IAUxB,OAAO,CAAC,MAAM,CAAC,cAAc;IAW7B,qDAAqD;IACrD,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,GAAG,EAAE,OAAO,E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