@visulima/pail 4.0.2 → 4.1.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.
Files changed (83) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE.md +346 -0
  3. package/README.md +17 -0
  4. package/dist/error.d.ts +69 -69
  5. package/dist/index.browser.d.ts +446 -445
  6. package/dist/index.browser.js +17 -17
  7. package/dist/index.server.d.ts +582 -582
  8. package/dist/index.server.js +27 -27
  9. package/dist/middleware/elysia.d.ts +44 -42
  10. package/dist/middleware/elysia.js +1 -1
  11. package/dist/middleware/express.d.ts +58 -59
  12. package/dist/middleware/express.js +1 -1
  13. package/dist/middleware/fastify.d.ts +55 -56
  14. package/dist/middleware/fastify.js +1 -1
  15. package/dist/middleware/hono.d.ts +56 -57
  16. package/dist/middleware/hono.js +1 -1
  17. package/dist/middleware/next/handler.d.ts +67 -68
  18. package/dist/middleware/next/handler.js +1 -1
  19. package/dist/middleware/sveltekit.d.ts +72 -73
  20. package/dist/middleware/sveltekit.js +1 -1
  21. package/dist/object-tree.d.ts +44 -44
  22. package/dist/packem_shared/AbstractJsonReporter-BpWRnN0L.js +1 -0
  23. package/dist/packem_shared/AbstractJsonReporter-DxZwImm5.js +1 -0
  24. package/dist/packem_shared/JsonReporter-9IcELa1m.js +2 -0
  25. package/dist/packem_shared/JsonReporter-Dd3kuj8X.js +1 -0
  26. package/dist/packem_shared/{PrettyReporter-DsHfKOU7.js → PrettyReporter-BUWNEg3_.js} +1 -1
  27. package/dist/packem_shared/{PrettyReporter-CcDdPQSt.js → PrettyReporter-DbgD89ck.js} +56 -30
  28. package/dist/packem_shared/abstract-json-reporter.d-B6NoO-hG.d.ts +61 -0
  29. package/dist/packem_shared/{abstract-pretty-reporter-DrLBJ6ds.js → abstract-pretty-reporter-CyfTvmKf.js} +41 -39
  30. package/dist/packem_shared/create-middleware-logger.d-BRkkBMlk.d.ts +47 -0
  31. package/dist/packem_shared/headers-DI58djdG.js +1 -0
  32. package/dist/packem_shared/index-CbkPnylC.js +1 -0
  33. package/dist/packem_shared/serializeError-52C4oiKx-CrnRcq9R.js +1 -0
  34. package/dist/packem_shared/storage-DVcJumyk.js +1 -0
  35. package/dist/packem_shared/types.d-4ge_rME4.d.ts +246 -0
  36. package/dist/packem_shared/{types.d-Cz9S7jZh.d.ts → types.d-BW8kAXUv.d.ts} +95 -95
  37. package/dist/packem_shared/types.d-DGHeA2iJ.d.ts +194 -0
  38. package/dist/packem_shared/useLogger-7p55yvvc.js +1 -0
  39. package/dist/packem_shared/wide-event.d-BMLastMR.d.ts +716 -0
  40. package/dist/packem_shared/write-stream-ytl_vhg_.js +1 -0
  41. package/dist/processor/caller/caller-processor.d.ts +32 -33
  42. package/dist/processor/environment-processor.d.ts +83 -84
  43. package/dist/processor/message-formatter-processor.d.ts +40 -45
  44. package/dist/processor/message-formatter-processor.js +1 -1
  45. package/dist/processor/opentelemetry-processor.d.ts +51 -52
  46. package/dist/processor/redact-processor.d.ts +57 -65
  47. package/dist/processor/sampling-processor.d.ts +90 -91
  48. package/dist/reporter/file/json-file-reporter.d.ts +77 -78
  49. package/dist/reporter/file/json-file-reporter.js +1 -1
  50. package/dist/reporter/http/abstract-http-reporter.d.ts +125 -121
  51. package/dist/reporter/http/abstract-http-reporter.js +2 -2
  52. package/dist/reporter/http/http-reporter.d.ts +33 -34
  53. package/dist/reporter/http/http-reporter.edge-light.d.ts +235 -230
  54. package/dist/reporter/http/http-reporter.edge-light.js +2 -2
  55. package/dist/reporter/json/index.browser.d.ts +62 -61
  56. package/dist/reporter/json/index.browser.js +1 -1
  57. package/dist/reporter/json/index.d.ts +36 -37
  58. package/dist/reporter/json/index.js +1 -1
  59. package/dist/reporter/pretty/index.browser.d.ts +57 -56
  60. package/dist/reporter/pretty/index.browser.js +1 -1
  61. package/dist/reporter/pretty/index.d.ts +133 -133
  62. package/dist/reporter/pretty/index.js +1 -1
  63. package/dist/reporter/simple/simple-reporter.server.d.ts +91 -90
  64. package/dist/reporter/simple/simple-reporter.server.js +7 -7
  65. package/dist/wide-event.d.ts +2 -3
  66. package/dist/wide-event.js +1 -1
  67. package/package.json +58 -37
  68. package/dist/packem_shared/AbstractJsonReporter-Bp_JCrMQ.js +0 -1
  69. package/dist/packem_shared/AbstractJsonReporter-w_bGGiD-.js +0 -1
  70. package/dist/packem_shared/JsonReporter-Sd_lJGS-.js +0 -2
  71. package/dist/packem_shared/JsonReporter-bmem9lcg.js +0 -1
  72. package/dist/packem_shared/abstract-json-reporter.d-wfESoEa-.d.ts +0 -62
  73. package/dist/packem_shared/addKnownErrorConstructor-C1OJTj2D-0FlJMfXz.js +0 -25
  74. package/dist/packem_shared/create-middleware-logger.d-B-JmQ1Sl.d.ts +0 -47
  75. package/dist/packem_shared/headers-DH0H2s8W.js +0 -1
  76. package/dist/packem_shared/index-Q1764hvO.js +0 -1
  77. package/dist/packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js +0 -1
  78. package/dist/packem_shared/storage-DaXAlpiO.js +0 -1
  79. package/dist/packem_shared/types.d-bWnqHJKL.d.ts +0 -211
  80. package/dist/packem_shared/types.d-xxE3FOD3.d.ts +0 -229
  81. package/dist/packem_shared/useLogger-DB34CuU5.js +0 -1
  82. package/dist/packem_shared/wide-event.d-D3ATYpoK.d.ts +0 -717
  83. package/dist/packem_shared/write-stream-C7jxLxIT.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import { InteractiveManager } from '@visulima/interactive-manager';
2
2
  import { LiteralUnion } from 'type-fest';
3
- import { M as Meta, D as DefaultLogTypes, L as LoggerTypesConfig, P as Processor, E as ExtendedRfc5424LogLevels, R as Reporter, a as LoggerFunction, C as ConstructorOptions, S as ServerConstructorOptions } from "./packem_shared/types.d-Cz9S7jZh.js";
4
- export type { b as DefaultLoggerTypes, c as LoggerConfiguration, d as LoggerTypesAwareReporter, e as StreamAwareReporter } from "./packem_shared/types.d-Cz9S7jZh.js";
3
+ import { M as Meta, D as DefaultLogTypes, L as LoggerTypesConfig, P as Processor, E as ExtendedRfc5424LogLevels, R as Reporter, a as LoggerFunction, C as ConstructorOptions, S as ServerConstructorOptions } from "./packem_shared/types.d-BW8kAXUv.js";
4
+ export type { b as DefaultLoggerTypes, c as LoggerConfiguration, d as LoggerTypesAwareReporter, e as StreamAwareReporter } from "./packem_shared/types.d-BW8kAXUv.js";
5
5
  import '@visulima/colorize';
6
6
  type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object);
7
7
  declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined;
@@ -19,28 +19,28 @@ interface StringifyOptions {
19
19
  strict?: boolean;
20
20
  }
21
21
  /**
22
- * Pail Browser Implementation.
23
- *
24
- * A comprehensive logging library for browser environments with support for
25
- * multiple log levels, custom types, processors, reporters, and advanced features
26
- * like throttling, scoping, timers, and counters.
27
- * @template T - Custom logger types (string union)
28
- * @template L - Log level types (string union)
29
- * @example
30
- * ```typescript
31
- * const logger = new PailBrowserImpl({
32
- * logLevel: "debug",
33
- * types: {
34
- * http: { color: "blue", label: "HTTP", logLevel: "info" }
35
- * },
36
- * reporters: [new JsonReporter()]
37
- * });
38
- *
39
- * logger.info("Application started");
40
- * logger.http("GET /api/users 200");
41
- * logger.error("Something went wrong", error);
42
- * ```
43
- */
22
+ * Pail Browser Implementation.
23
+ *
24
+ * A comprehensive logging library for browser environments with support for
25
+ * multiple log levels, custom types, processors, reporters, and advanced features
26
+ * like throttling, scoping, timers, and counters.
27
+ * @template T - Custom logger types (string union)
28
+ * @template L - Log level types (string union)
29
+ * @example
30
+ * ```typescript
31
+ * const logger = new PailBrowserImpl({
32
+ * logLevel: "debug",
33
+ * types: {
34
+ * http: { color: "blue", label: "HTTP", logLevel: "info" }
35
+ * },
36
+ * reporters: [new JsonReporter()]
37
+ * });
38
+ *
39
+ * logger.info("Application started");
40
+ * logger.http("GET /api/users 200");
41
+ * logger.error("Something went wrong", error);
42
+ * ```
43
+ */
44
44
  declare class PailBrowserImpl<T extends string = string, L extends string = string> {
45
45
  #private;
46
46
  protected readonly lastLog: {
@@ -73,361 +73,361 @@ declare class PailBrowserImpl<T extends string = string, L extends string = stri
73
73
  protected rawReporter: Reporter<L>;
74
74
  protected force: Record<string, LoggerFunction>;
75
75
  /**
76
- * Creates a new Pail browser logger instance.
77
- *
78
- * Initializes the logger with the provided configuration options,
79
- * setting up reporters, processors, log levels, and other internal state.
80
- * @param options Configuration options for the logger
81
- */
76
+ * Creates a new Pail browser logger instance.
77
+ *
78
+ * Initializes the logger with the provided configuration options,
79
+ * setting up reporters, processors, log levels, and other internal state.
80
+ * @param options Configuration options for the logger
81
+ */
82
82
  constructor(options: ConstructorOptions<T, L>);
83
83
  /**
84
- * Wraps the global console methods to redirect them through the logger.
85
- *
86
- * This method replaces console methods (log, info, warn, error, etc.) with
87
- * calls to the corresponding logger methods. The original console methods
88
- * are backed up and can be restored using restoreConsole().
89
- * @example
90
- * ```typescript
91
- * const logger = createPail();
92
- * logger.wrapConsole();
93
- *
94
- * console.log("This will go through the logger");
95
- * console.error("This too!");
96
- *
97
- * logger.restoreConsole(); // Restore original console methods
98
- * ```
99
- */
84
+ * Wraps the global console methods to redirect them through the logger.
85
+ *
86
+ * This method replaces console methods (log, info, warn, error, etc.) with
87
+ * calls to the corresponding logger methods. The original console methods
88
+ * are backed up and can be restored using restoreConsole().
89
+ * @example
90
+ * ```typescript
91
+ * const logger = createPail();
92
+ * logger.wrapConsole();
93
+ *
94
+ * console.log("This will go through the logger");
95
+ * console.error("This too!");
96
+ *
97
+ * logger.restoreConsole(); // Restore original console methods
98
+ * ```
99
+ */
100
100
  wrapConsole(): void;
101
101
  /**
102
- * Restores the original global console methods.
103
- *
104
- * This method restores the console methods that were backed up by wrapConsole().
105
- * After calling this, console methods will work as they did before wrapping.
106
- * @example
107
- * ```typescript
108
- * const logger = createPail();
109
- * logger.wrapConsole();
110
- *
111
- * // Console methods are now wrapped
112
- * logger.restoreConsole();
113
- * // Console methods are restored to original behavior
114
- * ```
115
- */
102
+ * Restores the original global console methods.
103
+ *
104
+ * This method restores the console methods that were backed up by wrapConsole().
105
+ * After calling this, console methods will work as they did before wrapping.
106
+ * @example
107
+ * ```typescript
108
+ * const logger = createPail();
109
+ * logger.wrapConsole();
110
+ *
111
+ * // Console methods are now wrapped
112
+ * logger.restoreConsole();
113
+ * // Console methods are restored to original behavior
114
+ * ```
115
+ */
116
116
  restoreConsole(): void;
117
117
  /**
118
- * Wraps uncaught exception and unhandled rejection handlers.
119
- *
120
- * This method sets up global error handlers that will log uncaught exceptions
121
- * and unhandled promise rejections through the logger. This is useful for
122
- * capturing and logging application crashes.
123
- * @example
124
- * ```typescript
125
- * const logger = createPail();
126
- * logger.wrapException();
127
- *
128
- * // Now uncaught errors will be logged
129
- * throw new Error("This will be logged");
130
- * ```
131
- */
118
+ * Wraps uncaught exception and unhandled rejection handlers.
119
+ *
120
+ * This method sets up global error handlers that will log uncaught exceptions
121
+ * and unhandled promise rejections through the logger. This is useful for
122
+ * capturing and logging application crashes.
123
+ * @example
124
+ * ```typescript
125
+ * const logger = createPail();
126
+ * logger.wrapException();
127
+ *
128
+ * // Now uncaught errors will be logged
129
+ * throw new Error("This will be logged");
130
+ * ```
131
+ */
132
132
  wrapException(): void;
133
133
  /**
134
- * Removes the global exception/rejection handlers installed by {@link wrapException}.
135
- *
136
- * Counterpart to `wrapException()` (mirrors `wrapConsole()`/`restoreConsole()`).
137
- * Safe to call when no handlers are installed.
138
- * @example
139
- * ```typescript
140
- * const logger = createPail();
141
- * logger.wrapException();
142
- * // ... later ...
143
- * logger.restoreException(); // global handlers removed
144
- * ```
145
- */
134
+ * Removes the global exception/rejection handlers installed by {@link wrapException}.
135
+ *
136
+ * Counterpart to `wrapException()` (mirrors `wrapConsole()`/`restoreConsole()`).
137
+ * Safe to call when no handlers are installed.
138
+ * @example
139
+ * ```typescript
140
+ * const logger = createPail();
141
+ * logger.wrapException();
142
+ * // ... later ...
143
+ * logger.restoreException(); // global handlers removed
144
+ * ```
145
+ */
146
146
  restoreException(): void;
147
147
  /**
148
- * Disables all logging output.
149
- *
150
- * When disabled, all log calls will be silently ignored and no output
151
- * will be produced by any reporters. This can be useful for temporarily
152
- * suppressing log output in production or during testing.
153
- * @example
154
- * ```typescript
155
- * const logger = createPail();
156
- * logger.disable();
157
- * logger.info("This won't be logged"); // Silent
158
- * logger.enable();
159
- * logger.info("This will be logged"); // Output produced
160
- * ```
161
- */
148
+ * Disables all logging output.
149
+ *
150
+ * When disabled, all log calls will be silently ignored and no output
151
+ * will be produced by any reporters. This can be useful for temporarily
152
+ * suppressing log output in production or during testing.
153
+ * @example
154
+ * ```typescript
155
+ * const logger = createPail();
156
+ * logger.disable();
157
+ * logger.info("This won't be logged"); // Silent
158
+ * logger.enable();
159
+ * logger.info("This will be logged"); // Output produced
160
+ * ```
161
+ */
162
162
  disable(): void;
163
163
  /**
164
- * Enables logging output.
165
- *
166
- * Re-enables logging after it has been disabled. All subsequent log calls
167
- * will produce output according to the configured reporters.
168
- * @example
169
- * ```typescript
170
- * const logger = createPail();
171
- * logger.disable();
172
- * logger.info("This won't be logged");
173
- * logger.enable(); // Re-enable logging
174
- * logger.info("This will be logged");
175
- * ```
176
- */
164
+ * Enables logging output.
165
+ *
166
+ * Re-enables logging after it has been disabled. All subsequent log calls
167
+ * will produce output according to the configured reporters.
168
+ * @example
169
+ * ```typescript
170
+ * const logger = createPail();
171
+ * logger.disable();
172
+ * logger.info("This won't be logged");
173
+ * logger.enable(); // Re-enable logging
174
+ * logger.info("This will be logged");
175
+ * ```
176
+ */
177
177
  enable(): void;
178
178
  /**
179
- * Checks if logging is currently enabled.
180
- *
181
- * Returns true if logging is enabled and false if it has been disabled.
182
- * @returns True if logging is enabled, false if disabled
183
- * @example
184
- * ```typescript
185
- * const logger = createPail();
186
- * console.log(logger.isEnabled()); // true
187
- * logger.disable();
188
- * console.log(logger.isEnabled()); // false
189
- * ```
190
- */
179
+ * Checks if logging is currently enabled.
180
+ *
181
+ * Returns true if logging is enabled and false if it has been disabled.
182
+ * @returns True if logging is enabled, false if disabled
183
+ * @example
184
+ * ```typescript
185
+ * const logger = createPail();
186
+ * console.log(logger.isEnabled()); // true
187
+ * logger.disable();
188
+ * console.log(logger.isEnabled()); // false
189
+ * ```
190
+ */
191
191
  isEnabled(): boolean;
192
192
  /**
193
- * Pauses logging and starts queuing messages.
194
- *
195
- * When paused, all log calls will be queued instead of being output immediately.
196
- * The queued messages will be processed when resume() is called. This is useful
197
- * for temporarily buffering log output during critical operations.
198
- * @example
199
- * ```typescript
200
- * const logger = createPail();
201
- * logger.pause();
202
- * logger.info("This will be queued"); // Queued, not output yet
203
- * logger.warn("This too"); // Also queued
204
- * logger.resume(); // Now both messages are output
205
- * ```
206
- */
193
+ * Pauses logging and starts queuing messages.
194
+ *
195
+ * When paused, all log calls will be queued instead of being output immediately.
196
+ * The queued messages will be processed when resume() is called. This is useful
197
+ * for temporarily buffering log output during critical operations.
198
+ * @example
199
+ * ```typescript
200
+ * const logger = createPail();
201
+ * logger.pause();
202
+ * logger.info("This will be queued"); // Queued, not output yet
203
+ * logger.warn("This too"); // Also queued
204
+ * logger.resume(); // Now both messages are output
205
+ * ```
206
+ */
207
207
  pause(): void;
208
208
  /**
209
- * Resumes logging and flushes all queued messages.
210
- *
211
- * Processes all messages that were queued during the pause period and
212
- * resumes normal logging behavior. Messages are output in the order
213
- * they were originally called.
214
- * @example
215
- * ```typescript
216
- * const logger = createPail();
217
- * logger.pause();
218
- * logger.info("Message 1"); // Queued
219
- * logger.info("Message 2"); // Queued
220
- * logger.resume(); // Both messages are now output in order
221
- * logger.info("Message 3"); // Output immediately
222
- * ```
223
- */
209
+ * Resumes logging and flushes all queued messages.
210
+ *
211
+ * Processes all messages that were queued during the pause period and
212
+ * resumes normal logging behavior. Messages are output in the order
213
+ * they were originally called.
214
+ * @example
215
+ * ```typescript
216
+ * const logger = createPail();
217
+ * logger.pause();
218
+ * logger.info("Message 1"); // Queued
219
+ * logger.info("Message 2"); // Queued
220
+ * logger.resume(); // Both messages are now output in order
221
+ * logger.info("Message 3"); // Output immediately
222
+ * ```
223
+ */
224
224
  resume(): void;
225
225
  /**
226
- * Creates a scoped logger instance.
227
- *
228
- * Returns a new logger instance that inherits all configuration but adds
229
- * the specified scope names to all log messages. This is useful for
230
- * categorizing logs by component, module, or feature.
231
- * @template N - The new custom logger type names
232
- * @param name Scope names to apply to all log messages
233
- * @returns A new scoped logger instance
234
- * @throws {Error} If no scope name is provided
235
- * @example
236
- * ```typescript
237
- * const logger = createPail();
238
- * const scopedLogger = logger.scope("auth", "login");
239
- * scopedLogger.info("User logged in"); // Will include scope: ["auth", "login"]
240
- * ```
241
- */
226
+ * Creates a scoped logger instance.
227
+ *
228
+ * Returns a new logger instance that inherits all configuration but adds
229
+ * the specified scope names to all log messages. This is useful for
230
+ * categorizing logs by component, module, or feature.
231
+ * @template N - The new custom logger type names
232
+ * @param name Scope names to apply to all log messages
233
+ * @returns A new scoped logger instance
234
+ * @throws {Error} If no scope name is provided
235
+ * @example
236
+ * ```typescript
237
+ * const logger = createPail();
238
+ * const scopedLogger = logger.scope("auth", "login");
239
+ * scopedLogger.info("User logged in"); // Will include scope: ["auth", "login"]
240
+ * ```
241
+ */
242
242
  scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
243
243
  /**
244
- * Removes the current scope from the logger.
245
- *
246
- * Clears all scope names that were set by previous scope() calls.
247
- * After calling this, log messages will no longer include scope information.
248
- * @example
249
- * ```typescript
250
- * const logger = createPail();
251
- * const scopedLogger = logger.scope("auth");
252
- * scopedLogger.info("Scoped message"); // Has scope
253
- * scopedLogger.unscope();
254
- * scopedLogger.info("Unscoped message"); // No scope
255
- * ```
256
- */
244
+ * Removes the current scope from the logger.
245
+ *
246
+ * Clears all scope names that were set by previous scope() calls.
247
+ * After calling this, log messages will no longer include scope information.
248
+ * @example
249
+ * ```typescript
250
+ * const logger = createPail();
251
+ * const scopedLogger = logger.scope("auth");
252
+ * scopedLogger.info("Scoped message"); // Has scope
253
+ * scopedLogger.unscope();
254
+ * scopedLogger.info("Unscoped message"); // No scope
255
+ * ```
256
+ */
257
257
  unscope(): void;
258
258
  /**
259
- * Creates a child logger that inherits settings from the parent.
260
- *
261
- * Returns a new logger instance that inherits all configuration from the parent
262
- * (reporters, processors, types, log levels, throttle settings, etc.) while allowing
263
- * you to override only what you need. Child loggers are independent instances with
264
- * their own state (timers, counters, etc.).
265
- * @template N - The new custom logger type names
266
- * @template LC - The new log level types
267
- * @param options Configuration options to override or extend parent settings
268
- * @returns A new child logger instance
269
- * @example
270
- * ```typescript
271
- * const parent = createPail({
272
- * logLevel: "info",
273
- * types: { http: { label: "HTTP", logLevel: "info" } },
274
- * reporters: [new PrettyReporter()],
275
- * });
276
- *
277
- * // Child inherits parent settings but overrides log level
278
- * const child = parent.child({ logLevel: "debug" });
279
- * child.info("This will be logged"); // Uses debug level from child
280
- * child.http("GET /api 200"); // Inherits http type from parent
281
- *
282
- * // Child can add new types
283
- * const childWithNewType = parent.child({
284
- * types: { db: { label: "DB", logLevel: "info" } },
285
- * });
286
- * childWithNewType.db("Query executed"); // New type available
287
- * ```
288
- */
259
+ * Creates a child logger that inherits settings from the parent.
260
+ *
261
+ * Returns a new logger instance that inherits all configuration from the parent
262
+ * (reporters, processors, types, log levels, throttle settings, etc.) while allowing
263
+ * you to override only what you need. Child loggers are independent instances with
264
+ * their own state (timers, counters, etc.).
265
+ * @template N - The new custom logger type names
266
+ * @template LC - The new log level types
267
+ * @param options Configuration options to override or extend parent settings
268
+ * @returns A new child logger instance
269
+ * @example
270
+ * ```typescript
271
+ * const parent = createPail({
272
+ * logLevel: "info",
273
+ * types: { http: { label: "HTTP", logLevel: "info" } },
274
+ * reporters: [new PrettyReporter()],
275
+ * });
276
+ *
277
+ * // Child inherits parent settings but overrides log level
278
+ * const child = parent.child({ logLevel: "debug" });
279
+ * child.info("This will be logged"); // Uses debug level from child
280
+ * child.http("GET /api 200"); // Inherits http type from parent
281
+ *
282
+ * // Child can add new types
283
+ * const childWithNewType = parent.child({
284
+ * types: { db: { label: "DB", logLevel: "info" } },
285
+ * });
286
+ * childWithNewType.db("Query executed"); // New type available
287
+ * ```
288
+ */
289
289
  child<N extends string = T, LC extends string = L>(options?: Partial<ConstructorOptions<N, LC>>): PailBrowserType<N, LC>;
290
290
  /**
291
- * Starts a timer with the specified label.
292
- *
293
- * Records the current timestamp and associates it with the given label.
294
- * Multiple timers can be active simultaneously with different labels.
295
- * @param label The timer label (defaults to "default")
296
- * @example
297
- * ```typescript
298
- * const logger = createPail();
299
- * logger.time("operation");
300
- * // ... some operation ...
301
- * logger.timeEnd("operation"); // Logs: "Timer run for: X ms"
302
- * ```
303
- */
291
+ * Starts a timer with the specified label.
292
+ *
293
+ * Records the current timestamp and associates it with the given label.
294
+ * Multiple timers can be active simultaneously with different labels.
295
+ * @param label The timer label (defaults to "default")
296
+ * @example
297
+ * ```typescript
298
+ * const logger = createPail();
299
+ * logger.time("operation");
300
+ * // ... some operation ...
301
+ * logger.timeEnd("operation"); // Logs: "Timer run for: X ms"
302
+ * ```
303
+ */
304
304
  time(label?: string): void;
305
305
  /**
306
- * Logs the current elapsed time for a timer without stopping it.
307
- *
308
- * Calculates and logs the time elapsed since the timer was started,
309
- * but keeps the timer running. If no label is provided, uses the
310
- * most recently started timer.
311
- * @param label The timer label (uses last timer if not specified)
312
- * @param data Additional data to include in the log message
313
- * @example
314
- * ```typescript
315
- * const logger = createPail();
316
- * logger.time("task");
317
- * // ... some work ...
318
- * logger.timeLog("task"); // Logs current elapsed time
319
- * // ... more work ...
320
- * logger.timeEnd("task"); // Logs final time and stops timer
321
- * ```
322
- */
306
+ * Logs the current elapsed time for a timer without stopping it.
307
+ *
308
+ * Calculates and logs the time elapsed since the timer was started,
309
+ * but keeps the timer running. If no label is provided, uses the
310
+ * most recently started timer.
311
+ * @param label The timer label (uses last timer if not specified)
312
+ * @param data Additional data to include in the log message
313
+ * @example
314
+ * ```typescript
315
+ * const logger = createPail();
316
+ * logger.time("task");
317
+ * // ... some work ...
318
+ * logger.timeLog("task"); // Logs current elapsed time
319
+ * // ... more work ...
320
+ * logger.timeEnd("task"); // Logs final time and stops timer
321
+ * ```
322
+ */
323
323
  timeLog(label?: string, ...data: unknown[]): void;
324
324
  /**
325
- * Stops a timer and logs the final elapsed time.
326
- *
327
- * Calculates the total time elapsed since the timer was started,
328
- * logs the result, and removes the timer. If no label is provided,
329
- * uses the most recently started timer.
330
- * @param label The timer label (uses last timer if not specified)
331
- * @example
332
- * ```typescript
333
- * const logger = createPail();
334
- * logger.time("operation");
335
- * // ... perform operation ...
336
- * logger.timeEnd("operation"); // Logs: "Timer run for: X ms"
337
- * ```
338
- */
325
+ * Stops a timer and logs the final elapsed time.
326
+ *
327
+ * Calculates the total time elapsed since the timer was started,
328
+ * logs the result, and removes the timer. If no label is provided,
329
+ * uses the most recently started timer.
330
+ * @param label The timer label (uses last timer if not specified)
331
+ * @example
332
+ * ```typescript
333
+ * const logger = createPail();
334
+ * logger.time("operation");
335
+ * // ... perform operation ...
336
+ * logger.timeEnd("operation"); // Logs: "Timer run for: X ms"
337
+ * ```
338
+ */
339
339
  timeEnd(label?: string): void;
340
340
  /**
341
- * Starts a log group with the specified label.
342
- *
343
- * Groups related log messages together. In browser environments,
344
- * this uses the native console.group() functionality. In other
345
- * environments, it tracks group nesting internally.
346
- * @param label The group label (defaults to "console.group")
347
- * @example
348
- * ```typescript
349
- * const logger = createPail();
350
- * logger.group("Database Operations");
351
- * logger.info("Connecting to database");
352
- * logger.info("Running migration");
353
- * logger.groupEnd(); // End the group
354
- * ```
355
- */
341
+ * Starts a log group with the specified label.
342
+ *
343
+ * Groups related log messages together. In browser environments,
344
+ * this uses the native console.group() functionality. In other
345
+ * environments, it tracks group nesting internally.
346
+ * @param label The group label (defaults to "console.group")
347
+ * @example
348
+ * ```typescript
349
+ * const logger = createPail();
350
+ * logger.group("Database Operations");
351
+ * logger.info("Connecting to database");
352
+ * logger.info("Running migration");
353
+ * logger.groupEnd(); // End the group
354
+ * ```
355
+ */
356
356
  group(label?: string): void;
357
357
  /**
358
- * Ends the current log group.
359
- *
360
- * Closes the most recently opened log group. In browser environments,
361
- * this uses the native console.groupEnd() functionality.
362
- * @example
363
- * ```typescript
364
- * const logger = createPail();
365
- * logger.group("Processing");
366
- * logger.info("Step 1");
367
- * logger.info("Step 2");
368
- * logger.groupEnd(); // Closes the "Processing" group
369
- * ```
370
- */
358
+ * Ends the current log group.
359
+ *
360
+ * Closes the most recently opened log group. In browser environments,
361
+ * this uses the native console.groupEnd() functionality.
362
+ * @example
363
+ * ```typescript
364
+ * const logger = createPail();
365
+ * logger.group("Processing");
366
+ * logger.info("Step 1");
367
+ * logger.info("Step 2");
368
+ * logger.groupEnd(); // Closes the "Processing" group
369
+ * ```
370
+ */
371
371
  groupEnd(): void;
372
372
  /**
373
- * Increments and logs a counter with the specified label.
374
- *
375
- * Maintains an internal counter for each label and logs the current count
376
- * each time it's called. Useful for tracking how many times certain
377
- * code paths are executed.
378
- * @param label The counter label (defaults to "default")
379
- * @example
380
- * ```typescript
381
- * const logger = createPail();
382
- * logger.count("requests"); // Logs: "requests: 1"
383
- * logger.count("requests"); // Logs: "requests: 2"
384
- * logger.count("errors"); // Logs: "errors: 1"
385
- * ```
386
- */
373
+ * Increments and logs a counter with the specified label.
374
+ *
375
+ * Maintains an internal counter for each label and logs the current count
376
+ * each time it's called. Useful for tracking how many times certain
377
+ * code paths are executed.
378
+ * @param label The counter label (defaults to "default")
379
+ * @example
380
+ * ```typescript
381
+ * const logger = createPail();
382
+ * logger.count("requests"); // Logs: "requests: 1"
383
+ * logger.count("requests"); // Logs: "requests: 2"
384
+ * logger.count("errors"); // Logs: "errors: 1"
385
+ * ```
386
+ */
387
387
  count(label?: string): void;
388
388
  /**
389
- * Resets a counter to zero.
390
- *
391
- * Removes the counter with the specified label, effectively resetting
392
- * it to zero. If the counter doesn't exist, logs a warning.
393
- * @param label The counter label to reset (defaults to "default")
394
- * @example
395
- * ```typescript
396
- * const logger = createPail();
397
- * logger.count("requests"); // Logs: "requests: 1"
398
- * logger.countReset("requests"); // Resets counter
399
- * logger.count("requests"); // Logs: "requests: 1" (starts over)
400
- * ```
401
- */
389
+ * Resets a counter to zero.
390
+ *
391
+ * Removes the counter with the specified label, effectively resetting
392
+ * it to zero. If the counter doesn't exist, logs a warning.
393
+ * @param label The counter label to reset (defaults to "default")
394
+ * @example
395
+ * ```typescript
396
+ * const logger = createPail();
397
+ * logger.count("requests"); // Logs: "requests: 1"
398
+ * logger.countReset("requests"); // Resets counter
399
+ * logger.count("requests"); // Logs: "requests: 1" (starts over)
400
+ * ```
401
+ */
402
402
  countReset(label?: string): void;
403
403
  /**
404
- * Clears the console output.
405
- *
406
- * Calls the native console.clear() method to clear all output from
407
- * the console. This is a convenience method that wraps the native
408
- * console.clear() functionality.
409
- * @example
410
- * ```typescript
411
- * const logger = createPail();
412
- * logger.info("Some message");
413
- * logger.clear(); // Clears the console
414
- * ```
415
- */
404
+ * Clears the console output.
405
+ *
406
+ * Calls the native console.clear() method to clear all output from
407
+ * the console. This is a convenience method that wraps the native
408
+ * console.clear() functionality.
409
+ * @example
410
+ * ```typescript
411
+ * const logger = createPail();
412
+ * logger.info("Some message");
413
+ * logger.clear(); // Clears the console
414
+ * ```
415
+ */
416
416
  clear(): void;
417
417
  /**
418
- * Logs a raw message bypassing normal processing.
419
- *
420
- * Sends a message directly to the raw reporter without going through
421
- * the normal logging pipeline (processors, throttling, etc.). This is
422
- * useful for logging that needs to bypass all formatting and processing.
423
- * @param message The raw message to log
424
- * @param arguments_ Additional arguments to include
425
- * @example
426
- * ```typescript
427
- * const logger = createPail();
428
- * logger.raw("Direct message", { data: "value" });
429
- * ```
430
- */
418
+ * Logs a raw message bypassing normal processing.
419
+ *
420
+ * Sends a message directly to the raw reporter without going through
421
+ * the normal logging pipeline (processors, throttling, etc.). This is
422
+ * useful for logging that needs to bypass all formatting and processing.
423
+ * @param message The raw message to log
424
+ * @param arguments_ Additional arguments to include
425
+ * @example
426
+ * ```typescript
427
+ * const logger = createPail();
428
+ * logger.raw("Direct message", { data: "value" });
429
+ * ```
430
+ */
431
431
  raw(message: string, ...arguments_: unknown[]): void;
432
432
  protected extendReporter(reporter: Reporter<L>): Reporter<L>;
433
433
  protected registerReporters(reporters: Reporter<L>[]): void;
@@ -445,144 +445,144 @@ declare class PailServerImpl<T extends string = string, L extends string = strin
445
445
  protected interactiveManager: InteractiveManager | undefined;
446
446
  protected readonly interactive: boolean;
447
447
  /**
448
- * Creates a new Pail server logger instance.
449
- *
450
- * Initializes the server-compatible logger with streams, interactive support,
451
- * and server-specific configuration options.
452
- * @param options Server-specific configuration options
453
- */
448
+ * Creates a new Pail server logger instance.
449
+ *
450
+ * Initializes the server-compatible logger with streams, interactive support,
451
+ * and server-specific configuration options.
452
+ * @param options Server-specific configuration options
453
+ */
454
454
  constructor(options: ServerConstructorOptions<T, L>);
455
455
  override scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
456
456
  /**
457
- * Creates a child logger that inherits settings from the parent.
458
- *
459
- * Returns a new logger instance that inherits all configuration from the parent
460
- * (reporters, processors, types, log levels, throttle settings, etc.) while allowing
461
- * you to override only what you need. Child loggers are independent instances with
462
- * their own state (timers, counters, etc.).
463
- * @template N - The new custom logger type names
464
- * @template LC - The new log level types
465
- * @param options Configuration options to override or extend parent settings
466
- * @returns A new child logger instance
467
- * @example
468
- * ```typescript
469
- * const parent = createPail({
470
- * logLevel: "info",
471
- * types: { http: { label: "HTTP", logLevel: "info" } },
472
- * reporters: [new PrettyReporter()],
473
- * });
474
- *
475
- * // Child inherits parent settings but overrides log level
476
- * const child = parent.child({ logLevel: "debug" });
477
- * child.info("This will be logged"); // Uses debug level from child
478
- * child.http("GET /api 200"); // Inherits http type from parent
479
- *
480
- * // Child can add new types
481
- * const childWithNewType = parent.child({
482
- * types: { db: { label: "DB", logLevel: "info" } },
483
- * });
484
- * childWithNewType.db("Query executed"); // New type available
485
- * ```
486
- */
457
+ * Creates a child logger that inherits settings from the parent.
458
+ *
459
+ * Returns a new logger instance that inherits all configuration from the parent
460
+ * (reporters, processors, types, log levels, throttle settings, etc.) while allowing
461
+ * you to override only what you need. Child loggers are independent instances with
462
+ * their own state (timers, counters, etc.).
463
+ * @template N - The new custom logger type names
464
+ * @template LC - The new log level types
465
+ * @param options Configuration options to override or extend parent settings
466
+ * @returns A new child logger instance
467
+ * @example
468
+ * ```typescript
469
+ * const parent = createPail({
470
+ * logLevel: "info",
471
+ * types: { http: { label: "HTTP", logLevel: "info" } },
472
+ * reporters: [new PrettyReporter()],
473
+ * });
474
+ *
475
+ * // Child inherits parent settings but overrides log level
476
+ * const child = parent.child({ logLevel: "debug" });
477
+ * child.info("This will be logged"); // Uses debug level from child
478
+ * child.http("GET /api 200"); // Inherits http type from parent
479
+ *
480
+ * // Child can add new types
481
+ * const childWithNewType = parent.child({
482
+ * types: { db: { label: "DB", logLevel: "info" } },
483
+ * });
484
+ * childWithNewType.db("Query executed"); // New type available
485
+ * ```
486
+ */
487
487
  override child<N extends string = T, LC extends string = L>(options?: Partial<ConstructorOptions<N, LC>> & Partial<Pick<ServerConstructorOptions<N, LC>, "interactive" | "stderr" | "stdout">>): PailServerType<N, LC>;
488
488
  /**
489
- * Gets the interactive manager instance if interactive mode is enabled.
490
- *
491
- * Returns the InteractiveManager instance that handles interactive terminal
492
- * features like progress bars and dynamic updates. Only available when
493
- * interactive mode is enabled in the constructor options.
494
- * @returns The interactive manager instance, or undefined if not in interactive mode
495
- * @example
496
- * ```typescript
497
- * const logger = createPail({ interactive: true });
498
- * const manager = logger.getInteractiveManager();
499
- * if (manager) {
500
- * manager.hook();
501
- * // Use interactive features
502
- * manager.unhook();
503
- * }
504
- * ```
505
- */
489
+ * Gets the interactive manager instance if interactive mode is enabled.
490
+ *
491
+ * Returns the InteractiveManager instance that handles interactive terminal
492
+ * features like progress bars and dynamic updates. Only available when
493
+ * interactive mode is enabled in the constructor options.
494
+ * @returns The interactive manager instance, or undefined if not in interactive mode
495
+ * @example
496
+ * ```typescript
497
+ * const logger = createPail({ interactive: true });
498
+ * const manager = logger.getInteractiveManager();
499
+ * if (manager) {
500
+ * manager.hook();
501
+ * // Use interactive features
502
+ * manager.unhook();
503
+ * }
504
+ * ```
505
+ */
506
506
  getInteractiveManager(): InteractiveManager | undefined;
507
507
  /**
508
- * Wraps stdout and stderr streams to redirect them through the logger.
509
- *
510
- * Intercepts writes to process.stdout and process.stderr, redirecting them
511
- * through the logger instead of writing directly to the streams. This allows
512
- * all output to be processed by the logging pipeline.
513
- * @example
514
- * ```typescript
515
- * const logger = createPail();
516
- * logger.wrapStd();
517
- *
518
- * console.log("This goes through logger");
519
- * process.stdout.write("This too");
520
- *
521
- * logger.restoreStd(); // Restore original streams
522
- * ```
523
- */
508
+ * Wraps stdout and stderr streams to redirect them through the logger.
509
+ *
510
+ * Intercepts writes to process.stdout and process.stderr, redirecting them
511
+ * through the logger instead of writing directly to the streams. This allows
512
+ * all output to be processed by the logging pipeline.
513
+ * @example
514
+ * ```typescript
515
+ * const logger = createPail();
516
+ * logger.wrapStd();
517
+ *
518
+ * console.log("This goes through logger");
519
+ * process.stdout.write("This too");
520
+ *
521
+ * logger.restoreStd(); // Restore original streams
522
+ * ```
523
+ */
524
524
  wrapStd(): void;
525
525
  /**
526
- * Restores the original stdout and stderr streams.
527
- *
528
- * Removes the stream wrapping that was applied by wrapStd(),
529
- * restoring the original stream write methods.
530
- * @example
531
- * ```typescript
532
- * const logger = createPail();
533
- * logger.wrapStd();
534
- * // Streams are wrapped
535
- * logger.restoreStd();
536
- * // Streams are restored to original behavior
537
- * ```
538
- */
526
+ * Restores the original stdout and stderr streams.
527
+ *
528
+ * Removes the stream wrapping that was applied by wrapStd(),
529
+ * restoring the original stream write methods.
530
+ * @example
531
+ * ```typescript
532
+ * const logger = createPail();
533
+ * logger.wrapStd();
534
+ * // Streams are wrapped
535
+ * logger.restoreStd();
536
+ * // Streams are restored to original behavior
537
+ * ```
538
+ */
539
539
  restoreStd(): void;
540
540
  /**
541
- * Wraps all output sources (console and streams).
542
- *
543
- * Convenience method that calls both wrapConsole() and wrapStd()
544
- * to redirect all output through the logger.
545
- * @example
546
- * ```typescript
547
- * const logger = createPail();
548
- * logger.wrapAll(); // Wraps console and streams
549
- *
550
- * // All output now goes through logger
551
- * console.log("Console output");
552
- * process.stdout.write("Stream output");
553
- *
554
- * logger.restoreAll(); // Restore everything
555
- * ```
556
- */
541
+ * Wraps all output sources (console and streams).
542
+ *
543
+ * Convenience method that calls both wrapConsole() and wrapStd()
544
+ * to redirect all output through the logger.
545
+ * @example
546
+ * ```typescript
547
+ * const logger = createPail();
548
+ * logger.wrapAll(); // Wraps console and streams
549
+ *
550
+ * // All output now goes through logger
551
+ * console.log("Console output");
552
+ * process.stdout.write("Stream output");
553
+ *
554
+ * logger.restoreAll(); // Restore everything
555
+ * ```
556
+ */
557
557
  wrapAll(): void;
558
558
  /**
559
- * Restores all wrapped output sources.
560
- *
561
- * Convenience method that calls both restoreConsole() and restoreStd()
562
- * to restore all original output behavior.
563
- * @example
564
- * ```typescript
565
- * const logger = createPail();
566
- * logger.wrapAll();
567
- * // All output is wrapped
568
- * logger.restoreAll();
569
- * // All output sources are restored
570
- * ```
571
- */
559
+ * Restores all wrapped output sources.
560
+ *
561
+ * Convenience method that calls both restoreConsole() and restoreStd()
562
+ * to restore all original output behavior.
563
+ * @example
564
+ * ```typescript
565
+ * const logger = createPail();
566
+ * logger.wrapAll();
567
+ * // All output is wrapped
568
+ * logger.restoreAll();
569
+ * // All output sources are restored
570
+ * ```
571
+ */
572
572
  restoreAll(): void;
573
573
  /**
574
- * Clears the terminal screen.
575
- *
576
- * Sends ANSI escape sequences to clear the terminal screen and move
577
- * the cursor to the top-left position. This overrides the browser
578
- * implementation to work with terminal streams.
579
- * @example
580
- * ```typescript
581
- * const logger = createPail();
582
- * logger.info("Some output");
583
- * logger.clear(); // Clears the terminal screen
584
- * ```
585
- */
574
+ * Clears the terminal screen.
575
+ *
576
+ * Sends ANSI escape sequences to clear the terminal screen and move
577
+ * the cursor to the top-left position. This overrides the browser
578
+ * implementation to work with terminal streams.
579
+ * @example
580
+ * ```typescript
581
+ * const logger = createPail();
582
+ * logger.info("Some output");
583
+ * logger.clear(); // Clears the terminal screen
584
+ * ```
585
+ */
586
586
  override clear(): void;
587
587
  protected override extendReporter(reporter: Reporter<L>): Reporter<L>;
588
588
  }
@@ -590,12 +590,12 @@ type PailServerType<T extends string = string, L extends string = string> = Cons
590
590
  force: Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction>;
591
591
  };
592
592
  /**
593
- * Options for creating a PailError.
594
- *
595
- * Extends standard error properties with self-documenting fields
596
- * that provide actionable context for debugging, particularly useful
597
- * for AI-assisted log analysis.
598
- */
593
+ * Options for creating a PailError.
594
+ *
595
+ * Extends standard error properties with self-documenting fields
596
+ * that provide actionable context for debugging, particularly useful
597
+ * for AI-assisted log analysis.
598
+ */
599
599
  interface PailErrorOptions {
600
600
  /** The root cause of this error */
601
601
  cause?: unknown;
@@ -611,41 +611,41 @@ interface PailErrorOptions {
611
611
  why?: string;
612
612
  }
613
613
  /**
614
- * Self-documenting error class for structured logging.
615
- *
616
- * Inspired by evlog's structured error approach, PailError extends the native
617
- * Error class with additional fields that make log entries immediately actionable:
618
- * - `why`: Explains what caused the failure
619
- * - `fix`: Suggests how to resolve the issue
620
- * - `link`: Points to relevant documentation
621
- * - `status`: HTTP status code for request-related errors
622
- *
623
- * These fields are preserved through the logging pipeline and displayed by reporters,
624
- * making it easier for both humans and AI agents to understand and resolve issues.
625
- * @example
626
- * ```typescript
627
- * import { PailError, createPailError } from "@visulima/pail/error";
628
- *
629
- * // Using the class directly
630
- * throw new PailError({
631
- * message: "Payment processing failed",
632
- * status: 402,
633
- * why: "The customer's card was declined by the payment provider",
634
- * fix: "Retry with a different payment method or contact the card issuer",
635
- * link: "https://docs.example.com/payments/declined",
636
- * });
637
- *
638
- * // Using the factory function
639
- * throw createPailError("Connection timeout");
640
- *
641
- * // With full options
642
- * throw createPailError({
643
- * message: "Database connection failed",
644
- * why: "Connection pool exhausted after 30s timeout",
645
- * fix: "Increase pool size or check for connection leaks",
646
- * });
647
- * ```
648
- */
614
+ * Self-documenting error class for structured logging.
615
+ *
616
+ * Inspired by evlog's structured error approach, PailError extends the native
617
+ * Error class with additional fields that make log entries immediately actionable:
618
+ * - `why`: Explains what caused the failure
619
+ * - `fix`: Suggests how to resolve the issue
620
+ * - `link`: Points to relevant documentation
621
+ * - `status`: HTTP status code for request-related errors
622
+ *
623
+ * These fields are preserved through the logging pipeline and displayed by reporters,
624
+ * making it easier for both humans and AI agents to understand and resolve issues.
625
+ * @example
626
+ * ```typescript
627
+ * import { PailError, createPailError } from "@visulima/pail/error";
628
+ *
629
+ * // Using the class directly
630
+ * throw new PailError({
631
+ * message: "Payment processing failed",
632
+ * status: 402,
633
+ * why: "The customer's card was declined by the payment provider",
634
+ * fix: "Retry with a different payment method or contact the card issuer",
635
+ * link: "https://docs.example.com/payments/declined",
636
+ * });
637
+ *
638
+ * // Using the factory function
639
+ * throw createPailError("Connection timeout");
640
+ *
641
+ * // With full options
642
+ * throw createPailError({
643
+ * message: "Database connection failed",
644
+ * why: "Connection pool exhausted after 30s timeout",
645
+ * fix: "Increase pool size or check for connection leaks",
646
+ * });
647
+ * ```
648
+ */
649
649
  declare class PailError extends Error {
650
650
  /** HTTP status code (defaults to 500) */
651
651
  readonly status: number;
@@ -657,95 +657,95 @@ declare class PailError extends Error {
657
657
  readonly link: string | undefined;
658
658
  constructor(options: PailErrorOptions | string);
659
659
  /**
660
- * Converts the error to a JSON-serializable object.
661
- *
662
- * Includes all self-documenting fields in the output for structured logging.
663
- * @returns A plain object representation of the error
664
- */
660
+ * Converts the error to a JSON-serializable object.
661
+ *
662
+ * Includes all self-documenting fields in the output for structured logging.
663
+ * @returns A plain object representation of the error
664
+ */
665
665
  toJSON(): Record<string, unknown>;
666
666
  /**
667
- * Returns a formatted string representation including self-documenting fields.
668
- * @returns Formatted error string with why/fix/link context
669
- */
667
+ * Returns a formatted string representation including self-documenting fields.
668
+ * @returns Formatted error string with why/fix/link context
669
+ */
670
670
  override toString(): string;
671
671
  }
672
672
  /**
673
- * Factory function for creating PailError instances.
674
- *
675
- * A convenient shorthand for creating PailError objects. Accepts either
676
- * a string message or a full PailErrorOptions object.
677
- * @param options Error message string or PailErrorOptions object
678
- * @returns A new PailError instance
679
- * @example
680
- * ```typescript
681
- * import { createPailError } from "@visulima/pail/error";
682
- *
683
- * throw createPailError("Something went wrong");
684
- *
685
- * throw createPailError({
686
- * message: "Auth failed",
687
- * status: 401,
688
- * why: "Token expired",
689
- * fix: "Refresh the authentication token",
690
- * });
691
- * ```
692
- */
673
+ * Factory function for creating PailError instances.
674
+ *
675
+ * A convenient shorthand for creating PailError objects. Accepts either
676
+ * a string message or a full PailErrorOptions object.
677
+ * @param options Error message string or PailErrorOptions object
678
+ * @returns A new PailError instance
679
+ * @example
680
+ * ```typescript
681
+ * import { createPailError } from "@visulima/pail/error";
682
+ *
683
+ * throw createPailError("Something went wrong");
684
+ *
685
+ * throw createPailError({
686
+ * message: "Auth failed",
687
+ * status: 401,
688
+ * why: "Token expired",
689
+ * fix: "Refresh the authentication token",
690
+ * });
691
+ * ```
692
+ */
693
693
  declare const createPailError: (options: PailErrorOptions | string) => PailError;
694
694
  /**
695
- * Creates a new Pail logger instance configured for server environments.
696
- *
697
- * This factory function creates a server-compatible logger with default processors
698
- * and reporters suitable for Node.js environments. It automatically configures
699
- * log levels based on environment variables and sets up pretty printing.
700
- * @template T - Custom logger types
701
- * @template L - Log level types
702
- * @param options Configuration options for the logger
703
- * @returns A new PailServer instance
704
- * @example
705
- * ```typescript
706
- * import { createPail } from "@visulima/pail";
707
- *
708
- * const logger = createPail({
709
- * logLevel: "debug",
710
- * types: {
711
- * http: {
712
- * color: "blue",
713
- * label: "HTTP",
714
- * logLevel: "info"
715
- * }
716
- * }
717
- * });
718
- *
719
- * logger.info("Server started on port 3000");
720
- * logger.http("GET /api/users 200");
721
- * ```
722
- * @example
723
- * ```bash
724
- * # Control log level via environment variable
725
- * PAIL_LOG_LEVEL=debug node app.js
726
- * ```
727
- */
695
+ * Creates a new Pail logger instance configured for server environments.
696
+ *
697
+ * This factory function creates a server-compatible logger with default processors
698
+ * and reporters suitable for Node.js environments. It automatically configures
699
+ * log levels based on environment variables and sets up pretty printing.
700
+ * @template T - Custom logger types
701
+ * @template L - Log level types
702
+ * @param options Configuration options for the logger
703
+ * @returns A new PailServer instance
704
+ * @example
705
+ * ```typescript
706
+ * import { createPail } from "@visulima/pail";
707
+ *
708
+ * const logger = createPail({
709
+ * logLevel: "debug",
710
+ * types: {
711
+ * http: {
712
+ * color: "blue",
713
+ * label: "HTTP",
714
+ * logLevel: "info"
715
+ * }
716
+ * }
717
+ * });
718
+ *
719
+ * logger.info("Server started on port 3000");
720
+ * logger.http("GET /api/users 200");
721
+ * ```
722
+ * @example
723
+ * ```bash
724
+ * # Control log level via environment variable
725
+ * PAIL_LOG_LEVEL=debug node app.js
726
+ * ```
727
+ */
728
728
  declare const createPail: <T extends string = string, L extends string = string>(options?: ServerConstructorOptions<T, L>) => PailServerType<T, L>;
729
729
  /**
730
- * Default Pail logger instance for server environments.
731
- *
732
- * A pre-configured logger instance ready for immediate use in Node.js environments.
733
- * Uses default configuration with pretty reporter, message formatter processor,
734
- * and automatic log level detection based on environment variables.
735
- * @example
736
- * ```typescript
737
- * import { pail } from "@visulima/pail";
738
- *
739
- * pail.info("Server listening on port 3000");
740
- * pail.error("Database connection failed", error);
741
- * pail.success("Migration completed successfully");
742
- * ```
743
- * @example
744
- * ```bash
745
- * # Set log level via environment
746
- * NODE_ENV=production node app.js
747
- * PAIL_LOG_LEVEL=debug node app.js
748
- * ```
749
- */
730
+ * Default Pail logger instance for server environments.
731
+ *
732
+ * A pre-configured logger instance ready for immediate use in Node.js environments.
733
+ * Uses default configuration with pretty reporter, message formatter processor,
734
+ * and automatic log level detection based on environment variables.
735
+ * @example
736
+ * ```typescript
737
+ * import { pail } from "@visulima/pail";
738
+ *
739
+ * pail.info("Server listening on port 3000");
740
+ * pail.error("Database connection failed", error);
741
+ * pail.success("Migration completed successfully");
742
+ * ```
743
+ * @example
744
+ * ```bash
745
+ * # Set log level via environment
746
+ * NODE_ENV=production node app.js
747
+ * PAIL_LOG_LEVEL=debug node app.js
748
+ * ```
749
+ */
750
750
  declare const pail: PailServerType;
751
751
  export { type ConstructorOptions, type DefaultLogTypes, type ExtendedRfc5424LogLevels, type LoggerFunction, type LoggerTypesConfig, type PailServerType as Pail, PailError, type PailErrorOptions, type Processor, type Reporter, createPail, createPailError, pail };