@visulima/cerebro 3.0.2 → 3.0.4

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 (34) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/MIGRATION-GUIDE.md +732 -0
  3. package/dist/commands/completion-command.d.ts +3 -3
  4. package/dist/commands/completion-command.js +1 -1
  5. package/dist/commands/help-command.d.ts +1 -1
  6. package/dist/commands/help-command.js +1 -1
  7. package/dist/commands/readme-command.d.ts +3 -3
  8. package/dist/commands/readme-command.js +17 -17
  9. package/dist/commands/version-command.d.ts +1 -1
  10. package/dist/index.d.ts +403 -433
  11. package/dist/index.js +1 -1
  12. package/dist/logger/create-pail-logger.d.ts +533 -555
  13. package/dist/packem_chunks/has-new-version.js +1 -1
  14. package/dist/packem_shared/Cerebro-CHB2i5uf.js +4 -0
  15. package/dist/packem_shared/{VisulimaError-C90oeIMu.js → VisulimaError-BheWBD7j.js} +2 -2
  16. package/dist/packem_shared/{cerebro-error-BjBcYVRO.js → cerebro-error-DnA3fjrR.js} +1 -1
  17. package/dist/packem_shared/command.d-B_G9vIYJ.d.ts +633 -0
  18. package/dist/packem_shared/{index-DvVGK4kr.js → index-BAKCiGjO.js} +10 -10
  19. package/dist/packem_shared/index.d-CnnVYgSZ.d.ts +117 -0
  20. package/dist/packem_shared/renderError-DjesnVYT-pHitCa3e.js +25 -0
  21. package/dist/packem_shared/split-by-case-DpyL5bdy.js +1 -0
  22. package/dist/plugins/error-handler-plugin.d.ts +18 -7
  23. package/dist/plugins/error-handler-plugin.js +1 -1
  24. package/dist/plugins/runtime-version-check-plugin.d.ts +5 -5
  25. package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +11 -10
  26. package/dist/util/general/compile-cache.d.ts +37 -37
  27. package/dist/util/general/heap-tuning.d.ts +11 -11
  28. package/dist/util/general/heap-tuning.js +1 -1
  29. package/package.json +4 -3
  30. package/dist/packem_shared/Cerebro-Czc4t-75.js +0 -4
  31. package/dist/packem_shared/command.d-DbhtfXF4.d.ts +0 -639
  32. package/dist/packem_shared/index.d-BL4NtVR3.d.ts +0 -127
  33. package/dist/packem_shared/renderError-B3ePOoBG-BmZlyMcr.js +0 -25
  34. package/dist/packem_shared/split-by-case-Dbpgd7rf.js +0 -1
@@ -2,36 +2,36 @@ import { InteractiveManager } from '@visulima/interactive-manager';
2
2
  import { LiteralUnion, Primitive } from 'type-fest';
3
3
  import { AnsiColors } from '@visulima/colorize';
4
4
  /**
5
- * Global namespace for extending Pail's metadata interface.
6
- *
7
- * This global declaration allows other packages and applications to extend
8
- * the Meta interface with custom properties by declaring additional properties
9
- * in the VisulimaPail.CustomMeta interface.
10
- * @example
11
- * ```typescript
12
- * declare global {
13
- * namespace VisulimaPail {
14
- * interface CustomMeta<L> {
15
- * userId?: string;
16
- * requestId?: string;
17
- * }
18
- * }
19
- * }
20
- * ```
21
- */
5
+ * Global namespace for extending Pail's metadata interface.
6
+ *
7
+ * This global declaration allows other packages and applications to extend
8
+ * the Meta interface with custom properties by declaring additional properties
9
+ * in the VisulimaPail.CustomMeta interface.
10
+ * @example
11
+ * ```typescript
12
+ * declare global {
13
+ * namespace VisulimaPail {
14
+ * interface CustomMeta<L> {
15
+ * userId?: string;
16
+ * requestId?: string;
17
+ * }
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
22
  declare global {
23
23
  namespace VisulimaPail {
24
24
  interface CustomMeta<L> {}
25
25
  }
26
26
  }
27
27
  /**
28
- * Metadata object containing all information about a log entry.
29
- *
30
- * This interface defines the structure of metadata that is passed to reporters
31
- * and processors. It contains all the contextual information about a log message
32
- * including the message itself, timing information, error details, and more.
33
- * @template L - The log level type
34
- */
28
+ * Metadata object containing all information about a log entry.
29
+ *
30
+ * This interface defines the structure of metadata that is passed to reporters
31
+ * and processors. It contains all the contextual information about a log message
32
+ * including the message itself, timing information, error details, and more.
33
+ * @template L - The log level type
34
+ */
35
35
  interface Meta<L> extends VisulimaPail.CustomMeta<L> {
36
36
  badge: string | undefined;
37
37
  context: any[] | undefined;
@@ -51,39 +51,39 @@ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
51
51
  };
52
52
  }
53
53
  /**
54
- * Extended RFC 5424 Log Levels.
55
- *
56
- * Standard syslog severity levels as defined in RFC 5424, plus additional
57
- * levels commonly used in modern applications. Each level has a numeric
58
- * priority where lower numbers indicate higher severity.
59
- * @see https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
60
- */
54
+ * Extended RFC 5424 Log Levels.
55
+ *
56
+ * Standard syslog severity levels as defined in RFC 5424, plus additional
57
+ * levels commonly used in modern applications. Each level has a numeric
58
+ * priority where lower numbers indicate higher severity.
59
+ * @see https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
60
+ */
61
61
  type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
62
62
  /**
63
- * Default Log Types.
64
- *
65
- * Predefined semantic log types that provide meaningful categorization
66
- * for different kinds of log messages. Each type has associated styling
67
- * and log level configuration.
68
- */
63
+ * Default Log Types.
64
+ *
65
+ * Predefined semantic log types that provide meaningful categorization
66
+ * for different kinds of log messages. Each type has associated styling
67
+ * and log level configuration.
68
+ */
69
69
  type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "warning" | "watch";
70
70
  /**
71
- * Logger Function Type.
72
- *
73
- * Represents a logging function that can accept either a structured Message object
74
- * or multiple arguments in the traditional console.log style.
75
- */
71
+ * Logger Function Type.
72
+ *
73
+ * Represents a logging function that can accept either a structured Message object
74
+ * or multiple arguments in the traditional console.log style.
75
+ */
76
76
  interface LoggerFunction {
77
77
  (message: Message): void;
78
78
  (...message: any[]): void;
79
79
  }
80
80
  /**
81
- * Logger Configuration.
82
- *
83
- * Configuration object that defines how a specific logger type should behave,
84
- * including its visual appearance and log level.
85
- * @template L - The log level type
86
- */
81
+ * Logger Configuration.
82
+ *
83
+ * Configuration object that defines how a specific logger type should behave,
84
+ * including its visual appearance and log level.
85
+ * @template L - The log level type
86
+ */
87
87
  interface LoggerConfiguration<L extends string> {
88
88
  badge?: string;
89
89
  color?: AnsiColors;
@@ -91,52 +91,37 @@ interface LoggerConfiguration<L extends string> {
91
91
  logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
92
92
  }
93
93
  /**
94
- * Logger Types Configuration.
95
- *
96
- * A record mapping logger type names to their configurations.
97
- * @template T - Custom logger type names
98
- * @template L - Log level types
99
- */
94
+ * Logger Types Configuration.
95
+ *
96
+ * A record mapping logger type names to their configurations.
97
+ * @template T - Custom logger type names
98
+ * @template L - Log level types
99
+ */
100
100
  type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
101
101
  /**
102
- * Default Logger Types Configuration.
103
- *
104
- * A complete mapping of all default log types to their full configurations.
105
- * @template L - Log level types
106
- */
107
-
108
- /**
109
- * Read-only Metadata.
110
- *
111
- * Immutable version of the Meta interface for use in reporters.
112
- * @template L - The log level type
113
- */
102
+ * Read-only Metadata.
103
+ *
104
+ * Immutable version of the Meta interface for use in reporters.
105
+ * @template L - The log level type
106
+ */
114
107
  type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
115
108
  /**
116
- * Reporter Interface.
117
- *
118
- * Base interface for all reporters. Reporters are responsible for
119
- * outputting log messages to various destinations (console, files, etc.).
120
- * @template L - The log level type
121
- */
109
+ * Reporter Interface.
110
+ *
111
+ * Base interface for all reporters. Reporters are responsible for
112
+ * outputting log messages to various destinations (console, files, etc.).
113
+ * @template L - The log level type
114
+ */
122
115
  interface Reporter<L extends string> {
123
116
  log: (meta: ReadonlyMeta<L>) => void;
124
117
  }
125
118
  /**
126
- * Stream-Aware Reporter Interface.
127
- *
128
- * Extends Reporter with the ability to work with Node.js streams.
129
- * Used for server-side reporters that need to write to stdout/stderr.
130
- * @template L - The log level type
131
- */
132
-
133
- /**
134
- * Processor Interface.
135
- *
136
- * Base interface for all processors. Processors can modify or enhance
137
- * log metadata before it reaches reporters.
138
- * @template L - The log level type
139
- */
119
+ * Processor Interface.
120
+ *
121
+ * Base interface for all processors. Processors can modify or enhance
122
+ * log metadata before it reaches reporters.
123
+ * @template L - The log level type
124
+ */
140
125
  interface Processor<L extends string> {
141
126
  /** Process the log metadata */
142
127
  process: (meta: Meta<L>) => Meta<L>;
@@ -184,28 +169,28 @@ interface StringifyOptions {
184
169
  strict?: boolean;
185
170
  }
186
171
  /**
187
- * Pail Browser Implementation.
188
- *
189
- * A comprehensive logging library for browser environments with support for
190
- * multiple log levels, custom types, processors, reporters, and advanced features
191
- * like throttling, scoping, timers, and counters.
192
- * @template T - Custom logger types (string union)
193
- * @template L - Log level types (string union)
194
- * @example
195
- * ```typescript
196
- * const logger = new PailBrowserImpl({
197
- * logLevel: "debug",
198
- * types: {
199
- * http: { color: "blue", label: "HTTP", logLevel: "info" }
200
- * },
201
- * reporters: [new JsonReporter()]
202
- * });
203
- *
204
- * logger.info("Application started");
205
- * logger.http("GET /api/users 200");
206
- * logger.error("Something went wrong", error);
207
- * ```
208
- */
172
+ * Pail Browser Implementation.
173
+ *
174
+ * A comprehensive logging library for browser environments with support for
175
+ * multiple log levels, custom types, processors, reporters, and advanced features
176
+ * like throttling, scoping, timers, and counters.
177
+ * @template T - Custom logger types (string union)
178
+ * @template L - Log level types (string union)
179
+ * @example
180
+ * ```typescript
181
+ * const logger = new PailBrowserImpl({
182
+ * logLevel: "debug",
183
+ * types: {
184
+ * http: { color: "blue", label: "HTTP", logLevel: "info" }
185
+ * },
186
+ * reporters: [new JsonReporter()]
187
+ * });
188
+ *
189
+ * logger.info("Application started");
190
+ * logger.http("GET /api/users 200");
191
+ * logger.error("Something went wrong", error);
192
+ * ```
193
+ */
209
194
  declare class PailBrowserImpl<T extends string = string, L extends string = string> {
210
195
  #private;
211
196
  protected readonly lastLog: {
@@ -238,361 +223,361 @@ declare class PailBrowserImpl<T extends string = string, L extends string = stri
238
223
  protected rawReporter: Reporter<L>;
239
224
  protected force: Record<string, LoggerFunction>;
240
225
  /**
241
- * Creates a new Pail browser logger instance.
242
- *
243
- * Initializes the logger with the provided configuration options,
244
- * setting up reporters, processors, log levels, and other internal state.
245
- * @param options Configuration options for the logger
246
- */
226
+ * Creates a new Pail browser logger instance.
227
+ *
228
+ * Initializes the logger with the provided configuration options,
229
+ * setting up reporters, processors, log levels, and other internal state.
230
+ * @param options Configuration options for the logger
231
+ */
247
232
  constructor(options: ConstructorOptions<T, L>);
248
233
  /**
249
- * Wraps the global console methods to redirect them through the logger.
250
- *
251
- * This method replaces console methods (log, info, warn, error, etc.) with
252
- * calls to the corresponding logger methods. The original console methods
253
- * are backed up and can be restored using restoreConsole().
254
- * @example
255
- * ```typescript
256
- * const logger = createPail();
257
- * logger.wrapConsole();
258
- *
259
- * console.log("This will go through the logger");
260
- * console.error("This too!");
261
- *
262
- * logger.restoreConsole(); // Restore original console methods
263
- * ```
264
- */
234
+ * Wraps the global console methods to redirect them through the logger.
235
+ *
236
+ * This method replaces console methods (log, info, warn, error, etc.) with
237
+ * calls to the corresponding logger methods. The original console methods
238
+ * are backed up and can be restored using restoreConsole().
239
+ * @example
240
+ * ```typescript
241
+ * const logger = createPail();
242
+ * logger.wrapConsole();
243
+ *
244
+ * console.log("This will go through the logger");
245
+ * console.error("This too!");
246
+ *
247
+ * logger.restoreConsole(); // Restore original console methods
248
+ * ```
249
+ */
265
250
  wrapConsole(): void;
266
251
  /**
267
- * Restores the original global console methods.
268
- *
269
- * This method restores the console methods that were backed up by wrapConsole().
270
- * After calling this, console methods will work as they did before wrapping.
271
- * @example
272
- * ```typescript
273
- * const logger = createPail();
274
- * logger.wrapConsole();
275
- *
276
- * // Console methods are now wrapped
277
- * logger.restoreConsole();
278
- * // Console methods are restored to original behavior
279
- * ```
280
- */
252
+ * Restores the original global console methods.
253
+ *
254
+ * This method restores the console methods that were backed up by wrapConsole().
255
+ * After calling this, console methods will work as they did before wrapping.
256
+ * @example
257
+ * ```typescript
258
+ * const logger = createPail();
259
+ * logger.wrapConsole();
260
+ *
261
+ * // Console methods are now wrapped
262
+ * logger.restoreConsole();
263
+ * // Console methods are restored to original behavior
264
+ * ```
265
+ */
281
266
  restoreConsole(): void;
282
267
  /**
283
- * Wraps uncaught exception and unhandled rejection handlers.
284
- *
285
- * This method sets up global error handlers that will log uncaught exceptions
286
- * and unhandled promise rejections through the logger. This is useful for
287
- * capturing and logging application crashes.
288
- * @example
289
- * ```typescript
290
- * const logger = createPail();
291
- * logger.wrapException();
292
- *
293
- * // Now uncaught errors will be logged
294
- * throw new Error("This will be logged");
295
- * ```
296
- */
268
+ * Wraps uncaught exception and unhandled rejection handlers.
269
+ *
270
+ * This method sets up global error handlers that will log uncaught exceptions
271
+ * and unhandled promise rejections through the logger. This is useful for
272
+ * capturing and logging application crashes.
273
+ * @example
274
+ * ```typescript
275
+ * const logger = createPail();
276
+ * logger.wrapException();
277
+ *
278
+ * // Now uncaught errors will be logged
279
+ * throw new Error("This will be logged");
280
+ * ```
281
+ */
297
282
  wrapException(): void;
298
283
  /**
299
- * Removes the global exception/rejection handlers installed by {@link wrapException}.
300
- *
301
- * Counterpart to `wrapException()` (mirrors `wrapConsole()`/`restoreConsole()`).
302
- * Safe to call when no handlers are installed.
303
- * @example
304
- * ```typescript
305
- * const logger = createPail();
306
- * logger.wrapException();
307
- * // ... later ...
308
- * logger.restoreException(); // global handlers removed
309
- * ```
310
- */
284
+ * Removes the global exception/rejection handlers installed by {@link wrapException}.
285
+ *
286
+ * Counterpart to `wrapException()` (mirrors `wrapConsole()`/`restoreConsole()`).
287
+ * Safe to call when no handlers are installed.
288
+ * @example
289
+ * ```typescript
290
+ * const logger = createPail();
291
+ * logger.wrapException();
292
+ * // ... later ...
293
+ * logger.restoreException(); // global handlers removed
294
+ * ```
295
+ */
311
296
  restoreException(): void;
312
297
  /**
313
- * Disables all logging output.
314
- *
315
- * When disabled, all log calls will be silently ignored and no output
316
- * will be produced by any reporters. This can be useful for temporarily
317
- * suppressing log output in production or during testing.
318
- * @example
319
- * ```typescript
320
- * const logger = createPail();
321
- * logger.disable();
322
- * logger.info("This won't be logged"); // Silent
323
- * logger.enable();
324
- * logger.info("This will be logged"); // Output produced
325
- * ```
326
- */
298
+ * Disables all logging output.
299
+ *
300
+ * When disabled, all log calls will be silently ignored and no output
301
+ * will be produced by any reporters. This can be useful for temporarily
302
+ * suppressing log output in production or during testing.
303
+ * @example
304
+ * ```typescript
305
+ * const logger = createPail();
306
+ * logger.disable();
307
+ * logger.info("This won't be logged"); // Silent
308
+ * logger.enable();
309
+ * logger.info("This will be logged"); // Output produced
310
+ * ```
311
+ */
327
312
  disable(): void;
328
313
  /**
329
- * Enables logging output.
330
- *
331
- * Re-enables logging after it has been disabled. All subsequent log calls
332
- * will produce output according to the configured reporters.
333
- * @example
334
- * ```typescript
335
- * const logger = createPail();
336
- * logger.disable();
337
- * logger.info("This won't be logged");
338
- * logger.enable(); // Re-enable logging
339
- * logger.info("This will be logged");
340
- * ```
341
- */
314
+ * Enables logging output.
315
+ *
316
+ * Re-enables logging after it has been disabled. All subsequent log calls
317
+ * will produce output according to the configured reporters.
318
+ * @example
319
+ * ```typescript
320
+ * const logger = createPail();
321
+ * logger.disable();
322
+ * logger.info("This won't be logged");
323
+ * logger.enable(); // Re-enable logging
324
+ * logger.info("This will be logged");
325
+ * ```
326
+ */
342
327
  enable(): void;
343
328
  /**
344
- * Checks if logging is currently enabled.
345
- *
346
- * Returns true if logging is enabled and false if it has been disabled.
347
- * @returns True if logging is enabled, false if disabled
348
- * @example
349
- * ```typescript
350
- * const logger = createPail();
351
- * console.log(logger.isEnabled()); // true
352
- * logger.disable();
353
- * console.log(logger.isEnabled()); // false
354
- * ```
355
- */
329
+ * Checks if logging is currently enabled.
330
+ *
331
+ * Returns true if logging is enabled and false if it has been disabled.
332
+ * @returns True if logging is enabled, false if disabled
333
+ * @example
334
+ * ```typescript
335
+ * const logger = createPail();
336
+ * console.log(logger.isEnabled()); // true
337
+ * logger.disable();
338
+ * console.log(logger.isEnabled()); // false
339
+ * ```
340
+ */
356
341
  isEnabled(): boolean;
357
342
  /**
358
- * Pauses logging and starts queuing messages.
359
- *
360
- * When paused, all log calls will be queued instead of being output immediately.
361
- * The queued messages will be processed when resume() is called. This is useful
362
- * for temporarily buffering log output during critical operations.
363
- * @example
364
- * ```typescript
365
- * const logger = createPail();
366
- * logger.pause();
367
- * logger.info("This will be queued"); // Queued, not output yet
368
- * logger.warn("This too"); // Also queued
369
- * logger.resume(); // Now both messages are output
370
- * ```
371
- */
343
+ * Pauses logging and starts queuing messages.
344
+ *
345
+ * When paused, all log calls will be queued instead of being output immediately.
346
+ * The queued messages will be processed when resume() is called. This is useful
347
+ * for temporarily buffering log output during critical operations.
348
+ * @example
349
+ * ```typescript
350
+ * const logger = createPail();
351
+ * logger.pause();
352
+ * logger.info("This will be queued"); // Queued, not output yet
353
+ * logger.warn("This too"); // Also queued
354
+ * logger.resume(); // Now both messages are output
355
+ * ```
356
+ */
372
357
  pause(): void;
373
358
  /**
374
- * Resumes logging and flushes all queued messages.
375
- *
376
- * Processes all messages that were queued during the pause period and
377
- * resumes normal logging behavior. Messages are output in the order
378
- * they were originally called.
379
- * @example
380
- * ```typescript
381
- * const logger = createPail();
382
- * logger.pause();
383
- * logger.info("Message 1"); // Queued
384
- * logger.info("Message 2"); // Queued
385
- * logger.resume(); // Both messages are now output in order
386
- * logger.info("Message 3"); // Output immediately
387
- * ```
388
- */
359
+ * Resumes logging and flushes all queued messages.
360
+ *
361
+ * Processes all messages that were queued during the pause period and
362
+ * resumes normal logging behavior. Messages are output in the order
363
+ * they were originally called.
364
+ * @example
365
+ * ```typescript
366
+ * const logger = createPail();
367
+ * logger.pause();
368
+ * logger.info("Message 1"); // Queued
369
+ * logger.info("Message 2"); // Queued
370
+ * logger.resume(); // Both messages are now output in order
371
+ * logger.info("Message 3"); // Output immediately
372
+ * ```
373
+ */
389
374
  resume(): void;
390
375
  /**
391
- * Creates a scoped logger instance.
392
- *
393
- * Returns a new logger instance that inherits all configuration but adds
394
- * the specified scope names to all log messages. This is useful for
395
- * categorizing logs by component, module, or feature.
396
- * @template N - The new custom logger type names
397
- * @param name Scope names to apply to all log messages
398
- * @returns A new scoped logger instance
399
- * @throws {Error} If no scope name is provided
400
- * @example
401
- * ```typescript
402
- * const logger = createPail();
403
- * const scopedLogger = logger.scope("auth", "login");
404
- * scopedLogger.info("User logged in"); // Will include scope: ["auth", "login"]
405
- * ```
406
- */
376
+ * Creates a scoped logger instance.
377
+ *
378
+ * Returns a new logger instance that inherits all configuration but adds
379
+ * the specified scope names to all log messages. This is useful for
380
+ * categorizing logs by component, module, or feature.
381
+ * @template N - The new custom logger type names
382
+ * @param name Scope names to apply to all log messages
383
+ * @returns A new scoped logger instance
384
+ * @throws {Error} If no scope name is provided
385
+ * @example
386
+ * ```typescript
387
+ * const logger = createPail();
388
+ * const scopedLogger = logger.scope("auth", "login");
389
+ * scopedLogger.info("User logged in"); // Will include scope: ["auth", "login"]
390
+ * ```
391
+ */
407
392
  scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
408
393
  /**
409
- * Removes the current scope from the logger.
410
- *
411
- * Clears all scope names that were set by previous scope() calls.
412
- * After calling this, log messages will no longer include scope information.
413
- * @example
414
- * ```typescript
415
- * const logger = createPail();
416
- * const scopedLogger = logger.scope("auth");
417
- * scopedLogger.info("Scoped message"); // Has scope
418
- * scopedLogger.unscope();
419
- * scopedLogger.info("Unscoped message"); // No scope
420
- * ```
421
- */
394
+ * Removes the current scope from the logger.
395
+ *
396
+ * Clears all scope names that were set by previous scope() calls.
397
+ * After calling this, log messages will no longer include scope information.
398
+ * @example
399
+ * ```typescript
400
+ * const logger = createPail();
401
+ * const scopedLogger = logger.scope("auth");
402
+ * scopedLogger.info("Scoped message"); // Has scope
403
+ * scopedLogger.unscope();
404
+ * scopedLogger.info("Unscoped message"); // No scope
405
+ * ```
406
+ */
422
407
  unscope(): void;
423
408
  /**
424
- * Creates a child logger that inherits settings from the parent.
425
- *
426
- * Returns a new logger instance that inherits all configuration from the parent
427
- * (reporters, processors, types, log levels, throttle settings, etc.) while allowing
428
- * you to override only what you need. Child loggers are independent instances with
429
- * their own state (timers, counters, etc.).
430
- * @template N - The new custom logger type names
431
- * @template LC - The new log level types
432
- * @param options Configuration options to override or extend parent settings
433
- * @returns A new child logger instance
434
- * @example
435
- * ```typescript
436
- * const parent = createPail({
437
- * logLevel: "info",
438
- * types: { http: { label: "HTTP", logLevel: "info" } },
439
- * reporters: [new PrettyReporter()],
440
- * });
441
- *
442
- * // Child inherits parent settings but overrides log level
443
- * const child = parent.child({ logLevel: "debug" });
444
- * child.info("This will be logged"); // Uses debug level from child
445
- * child.http("GET /api 200"); // Inherits http type from parent
446
- *
447
- * // Child can add new types
448
- * const childWithNewType = parent.child({
449
- * types: { db: { label: "DB", logLevel: "info" } },
450
- * });
451
- * childWithNewType.db("Query executed"); // New type available
452
- * ```
453
- */
409
+ * Creates a child logger that inherits settings from the parent.
410
+ *
411
+ * Returns a new logger instance that inherits all configuration from the parent
412
+ * (reporters, processors, types, log levels, throttle settings, etc.) while allowing
413
+ * you to override only what you need. Child loggers are independent instances with
414
+ * their own state (timers, counters, etc.).
415
+ * @template N - The new custom logger type names
416
+ * @template LC - The new log level types
417
+ * @param options Configuration options to override or extend parent settings
418
+ * @returns A new child logger instance
419
+ * @example
420
+ * ```typescript
421
+ * const parent = createPail({
422
+ * logLevel: "info",
423
+ * types: { http: { label: "HTTP", logLevel: "info" } },
424
+ * reporters: [new PrettyReporter()],
425
+ * });
426
+ *
427
+ * // Child inherits parent settings but overrides log level
428
+ * const child = parent.child({ logLevel: "debug" });
429
+ * child.info("This will be logged"); // Uses debug level from child
430
+ * child.http("GET /api 200"); // Inherits http type from parent
431
+ *
432
+ * // Child can add new types
433
+ * const childWithNewType = parent.child({
434
+ * types: { db: { label: "DB", logLevel: "info" } },
435
+ * });
436
+ * childWithNewType.db("Query executed"); // New type available
437
+ * ```
438
+ */
454
439
  child<N extends string = T, LC extends string = L>(options?: Partial<ConstructorOptions<N, LC>>): PailBrowserType<N, LC>;
455
440
  /**
456
- * Starts a timer with the specified label.
457
- *
458
- * Records the current timestamp and associates it with the given label.
459
- * Multiple timers can be active simultaneously with different labels.
460
- * @param label The timer label (defaults to "default")
461
- * @example
462
- * ```typescript
463
- * const logger = createPail();
464
- * logger.time("operation");
465
- * // ... some operation ...
466
- * logger.timeEnd("operation"); // Logs: "Timer run for: X ms"
467
- * ```
468
- */
441
+ * Starts a timer with the specified label.
442
+ *
443
+ * Records the current timestamp and associates it with the given label.
444
+ * Multiple timers can be active simultaneously with different labels.
445
+ * @param label The timer label (defaults to "default")
446
+ * @example
447
+ * ```typescript
448
+ * const logger = createPail();
449
+ * logger.time("operation");
450
+ * // ... some operation ...
451
+ * logger.timeEnd("operation"); // Logs: "Timer run for: X ms"
452
+ * ```
453
+ */
469
454
  time(label?: string): void;
470
455
  /**
471
- * Logs the current elapsed time for a timer without stopping it.
472
- *
473
- * Calculates and logs the time elapsed since the timer was started,
474
- * but keeps the timer running. If no label is provided, uses the
475
- * most recently started timer.
476
- * @param label The timer label (uses last timer if not specified)
477
- * @param data Additional data to include in the log message
478
- * @example
479
- * ```typescript
480
- * const logger = createPail();
481
- * logger.time("task");
482
- * // ... some work ...
483
- * logger.timeLog("task"); // Logs current elapsed time
484
- * // ... more work ...
485
- * logger.timeEnd("task"); // Logs final time and stops timer
486
- * ```
487
- */
456
+ * Logs the current elapsed time for a timer without stopping it.
457
+ *
458
+ * Calculates and logs the time elapsed since the timer was started,
459
+ * but keeps the timer running. If no label is provided, uses the
460
+ * most recently started timer.
461
+ * @param label The timer label (uses last timer if not specified)
462
+ * @param data Additional data to include in the log message
463
+ * @example
464
+ * ```typescript
465
+ * const logger = createPail();
466
+ * logger.time("task");
467
+ * // ... some work ...
468
+ * logger.timeLog("task"); // Logs current elapsed time
469
+ * // ... more work ...
470
+ * logger.timeEnd("task"); // Logs final time and stops timer
471
+ * ```
472
+ */
488
473
  timeLog(label?: string, ...data: unknown[]): void;
489
474
  /**
490
- * Stops a timer and logs the final elapsed time.
491
- *
492
- * Calculates the total time elapsed since the timer was started,
493
- * logs the result, and removes the timer. If no label is provided,
494
- * uses the most recently started timer.
495
- * @param label The timer label (uses last timer if not specified)
496
- * @example
497
- * ```typescript
498
- * const logger = createPail();
499
- * logger.time("operation");
500
- * // ... perform operation ...
501
- * logger.timeEnd("operation"); // Logs: "Timer run for: X ms"
502
- * ```
503
- */
475
+ * Stops a timer and logs the final elapsed time.
476
+ *
477
+ * Calculates the total time elapsed since the timer was started,
478
+ * logs the result, and removes the timer. If no label is provided,
479
+ * uses the most recently started timer.
480
+ * @param label The timer label (uses last timer if not specified)
481
+ * @example
482
+ * ```typescript
483
+ * const logger = createPail();
484
+ * logger.time("operation");
485
+ * // ... perform operation ...
486
+ * logger.timeEnd("operation"); // Logs: "Timer run for: X ms"
487
+ * ```
488
+ */
504
489
  timeEnd(label?: string): void;
505
490
  /**
506
- * Starts a log group with the specified label.
507
- *
508
- * Groups related log messages together. In browser environments,
509
- * this uses the native console.group() functionality. In other
510
- * environments, it tracks group nesting internally.
511
- * @param label The group label (defaults to "console.group")
512
- * @example
513
- * ```typescript
514
- * const logger = createPail();
515
- * logger.group("Database Operations");
516
- * logger.info("Connecting to database");
517
- * logger.info("Running migration");
518
- * logger.groupEnd(); // End the group
519
- * ```
520
- */
491
+ * Starts a log group with the specified label.
492
+ *
493
+ * Groups related log messages together. In browser environments,
494
+ * this uses the native console.group() functionality. In other
495
+ * environments, it tracks group nesting internally.
496
+ * @param label The group label (defaults to "console.group")
497
+ * @example
498
+ * ```typescript
499
+ * const logger = createPail();
500
+ * logger.group("Database Operations");
501
+ * logger.info("Connecting to database");
502
+ * logger.info("Running migration");
503
+ * logger.groupEnd(); // End the group
504
+ * ```
505
+ */
521
506
  group(label?: string): void;
522
507
  /**
523
- * Ends the current log group.
524
- *
525
- * Closes the most recently opened log group. In browser environments,
526
- * this uses the native console.groupEnd() functionality.
527
- * @example
528
- * ```typescript
529
- * const logger = createPail();
530
- * logger.group("Processing");
531
- * logger.info("Step 1");
532
- * logger.info("Step 2");
533
- * logger.groupEnd(); // Closes the "Processing" group
534
- * ```
535
- */
508
+ * Ends the current log group.
509
+ *
510
+ * Closes the most recently opened log group. In browser environments,
511
+ * this uses the native console.groupEnd() functionality.
512
+ * @example
513
+ * ```typescript
514
+ * const logger = createPail();
515
+ * logger.group("Processing");
516
+ * logger.info("Step 1");
517
+ * logger.info("Step 2");
518
+ * logger.groupEnd(); // Closes the "Processing" group
519
+ * ```
520
+ */
536
521
  groupEnd(): void;
537
522
  /**
538
- * Increments and logs a counter with the specified label.
539
- *
540
- * Maintains an internal counter for each label and logs the current count
541
- * each time it's called. Useful for tracking how many times certain
542
- * code paths are executed.
543
- * @param label The counter label (defaults to "default")
544
- * @example
545
- * ```typescript
546
- * const logger = createPail();
547
- * logger.count("requests"); // Logs: "requests: 1"
548
- * logger.count("requests"); // Logs: "requests: 2"
549
- * logger.count("errors"); // Logs: "errors: 1"
550
- * ```
551
- */
523
+ * Increments and logs a counter with the specified label.
524
+ *
525
+ * Maintains an internal counter for each label and logs the current count
526
+ * each time it's called. Useful for tracking how many times certain
527
+ * code paths are executed.
528
+ * @param label The counter label (defaults to "default")
529
+ * @example
530
+ * ```typescript
531
+ * const logger = createPail();
532
+ * logger.count("requests"); // Logs: "requests: 1"
533
+ * logger.count("requests"); // Logs: "requests: 2"
534
+ * logger.count("errors"); // Logs: "errors: 1"
535
+ * ```
536
+ */
552
537
  count(label?: string): void;
553
538
  /**
554
- * Resets a counter to zero.
555
- *
556
- * Removes the counter with the specified label, effectively resetting
557
- * it to zero. If the counter doesn't exist, logs a warning.
558
- * @param label The counter label to reset (defaults to "default")
559
- * @example
560
- * ```typescript
561
- * const logger = createPail();
562
- * logger.count("requests"); // Logs: "requests: 1"
563
- * logger.countReset("requests"); // Resets counter
564
- * logger.count("requests"); // Logs: "requests: 1" (starts over)
565
- * ```
566
- */
539
+ * Resets a counter to zero.
540
+ *
541
+ * Removes the counter with the specified label, effectively resetting
542
+ * it to zero. If the counter doesn't exist, logs a warning.
543
+ * @param label The counter label to reset (defaults to "default")
544
+ * @example
545
+ * ```typescript
546
+ * const logger = createPail();
547
+ * logger.count("requests"); // Logs: "requests: 1"
548
+ * logger.countReset("requests"); // Resets counter
549
+ * logger.count("requests"); // Logs: "requests: 1" (starts over)
550
+ * ```
551
+ */
567
552
  countReset(label?: string): void;
568
553
  /**
569
- * Clears the console output.
570
- *
571
- * Calls the native console.clear() method to clear all output from
572
- * the console. This is a convenience method that wraps the native
573
- * console.clear() functionality.
574
- * @example
575
- * ```typescript
576
- * const logger = createPail();
577
- * logger.info("Some message");
578
- * logger.clear(); // Clears the console
579
- * ```
580
- */
554
+ * Clears the console output.
555
+ *
556
+ * Calls the native console.clear() method to clear all output from
557
+ * the console. This is a convenience method that wraps the native
558
+ * console.clear() functionality.
559
+ * @example
560
+ * ```typescript
561
+ * const logger = createPail();
562
+ * logger.info("Some message");
563
+ * logger.clear(); // Clears the console
564
+ * ```
565
+ */
581
566
  clear(): void;
582
567
  /**
583
- * Logs a raw message bypassing normal processing.
584
- *
585
- * Sends a message directly to the raw reporter without going through
586
- * the normal logging pipeline (processors, throttling, etc.). This is
587
- * useful for logging that needs to bypass all formatting and processing.
588
- * @param message The raw message to log
589
- * @param arguments_ Additional arguments to include
590
- * @example
591
- * ```typescript
592
- * const logger = createPail();
593
- * logger.raw("Direct message", { data: "value" });
594
- * ```
595
- */
568
+ * Logs a raw message bypassing normal processing.
569
+ *
570
+ * Sends a message directly to the raw reporter without going through
571
+ * the normal logging pipeline (processors, throttling, etc.). This is
572
+ * useful for logging that needs to bypass all formatting and processing.
573
+ * @param message The raw message to log
574
+ * @param arguments_ Additional arguments to include
575
+ * @example
576
+ * ```typescript
577
+ * const logger = createPail();
578
+ * logger.raw("Direct message", { data: "value" });
579
+ * ```
580
+ */
596
581
  raw(message: string, ...arguments_: unknown[]): void;
597
582
  protected extendReporter(reporter: Reporter<L>): Reporter<L>;
598
583
  protected registerReporters(reporters: Reporter<L>[]): void;
@@ -610,144 +595,144 @@ declare class PailServerImpl<T extends string = string, L extends string = strin
610
595
  protected interactiveManager: InteractiveManager | undefined;
611
596
  protected readonly interactive: boolean;
612
597
  /**
613
- * Creates a new Pail server logger instance.
614
- *
615
- * Initializes the server-compatible logger with streams, interactive support,
616
- * and server-specific configuration options.
617
- * @param options Server-specific configuration options
618
- */
598
+ * Creates a new Pail server logger instance.
599
+ *
600
+ * Initializes the server-compatible logger with streams, interactive support,
601
+ * and server-specific configuration options.
602
+ * @param options Server-specific configuration options
603
+ */
619
604
  constructor(options: ServerConstructorOptions<T, L>);
620
605
  override scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
621
606
  /**
622
- * Creates a child logger that inherits settings from the parent.
623
- *
624
- * Returns a new logger instance that inherits all configuration from the parent
625
- * (reporters, processors, types, log levels, throttle settings, etc.) while allowing
626
- * you to override only what you need. Child loggers are independent instances with
627
- * their own state (timers, counters, etc.).
628
- * @template N - The new custom logger type names
629
- * @template LC - The new log level types
630
- * @param options Configuration options to override or extend parent settings
631
- * @returns A new child logger instance
632
- * @example
633
- * ```typescript
634
- * const parent = createPail({
635
- * logLevel: "info",
636
- * types: { http: { label: "HTTP", logLevel: "info" } },
637
- * reporters: [new PrettyReporter()],
638
- * });
639
- *
640
- * // Child inherits parent settings but overrides log level
641
- * const child = parent.child({ logLevel: "debug" });
642
- * child.info("This will be logged"); // Uses debug level from child
643
- * child.http("GET /api 200"); // Inherits http type from parent
644
- *
645
- * // Child can add new types
646
- * const childWithNewType = parent.child({
647
- * types: { db: { label: "DB", logLevel: "info" } },
648
- * });
649
- * childWithNewType.db("Query executed"); // New type available
650
- * ```
651
- */
607
+ * Creates a child logger that inherits settings from the parent.
608
+ *
609
+ * Returns a new logger instance that inherits all configuration from the parent
610
+ * (reporters, processors, types, log levels, throttle settings, etc.) while allowing
611
+ * you to override only what you need. Child loggers are independent instances with
612
+ * their own state (timers, counters, etc.).
613
+ * @template N - The new custom logger type names
614
+ * @template LC - The new log level types
615
+ * @param options Configuration options to override or extend parent settings
616
+ * @returns A new child logger instance
617
+ * @example
618
+ * ```typescript
619
+ * const parent = createPail({
620
+ * logLevel: "info",
621
+ * types: { http: { label: "HTTP", logLevel: "info" } },
622
+ * reporters: [new PrettyReporter()],
623
+ * });
624
+ *
625
+ * // Child inherits parent settings but overrides log level
626
+ * const child = parent.child({ logLevel: "debug" });
627
+ * child.info("This will be logged"); // Uses debug level from child
628
+ * child.http("GET /api 200"); // Inherits http type from parent
629
+ *
630
+ * // Child can add new types
631
+ * const childWithNewType = parent.child({
632
+ * types: { db: { label: "DB", logLevel: "info" } },
633
+ * });
634
+ * childWithNewType.db("Query executed"); // New type available
635
+ * ```
636
+ */
652
637
  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>;
653
638
  /**
654
- * Gets the interactive manager instance if interactive mode is enabled.
655
- *
656
- * Returns the InteractiveManager instance that handles interactive terminal
657
- * features like progress bars and dynamic updates. Only available when
658
- * interactive mode is enabled in the constructor options.
659
- * @returns The interactive manager instance, or undefined if not in interactive mode
660
- * @example
661
- * ```typescript
662
- * const logger = createPail({ interactive: true });
663
- * const manager = logger.getInteractiveManager();
664
- * if (manager) {
665
- * manager.hook();
666
- * // Use interactive features
667
- * manager.unhook();
668
- * }
669
- * ```
670
- */
639
+ * Gets the interactive manager instance if interactive mode is enabled.
640
+ *
641
+ * Returns the InteractiveManager instance that handles interactive terminal
642
+ * features like progress bars and dynamic updates. Only available when
643
+ * interactive mode is enabled in the constructor options.
644
+ * @returns The interactive manager instance, or undefined if not in interactive mode
645
+ * @example
646
+ * ```typescript
647
+ * const logger = createPail({ interactive: true });
648
+ * const manager = logger.getInteractiveManager();
649
+ * if (manager) {
650
+ * manager.hook();
651
+ * // Use interactive features
652
+ * manager.unhook();
653
+ * }
654
+ * ```
655
+ */
671
656
  getInteractiveManager(): InteractiveManager | undefined;
672
657
  /**
673
- * Wraps stdout and stderr streams to redirect them through the logger.
674
- *
675
- * Intercepts writes to process.stdout and process.stderr, redirecting them
676
- * through the logger instead of writing directly to the streams. This allows
677
- * all output to be processed by the logging pipeline.
678
- * @example
679
- * ```typescript
680
- * const logger = createPail();
681
- * logger.wrapStd();
682
- *
683
- * console.log("This goes through logger");
684
- * process.stdout.write("This too");
685
- *
686
- * logger.restoreStd(); // Restore original streams
687
- * ```
688
- */
658
+ * Wraps stdout and stderr streams to redirect them through the logger.
659
+ *
660
+ * Intercepts writes to process.stdout and process.stderr, redirecting them
661
+ * through the logger instead of writing directly to the streams. This allows
662
+ * all output to be processed by the logging pipeline.
663
+ * @example
664
+ * ```typescript
665
+ * const logger = createPail();
666
+ * logger.wrapStd();
667
+ *
668
+ * console.log("This goes through logger");
669
+ * process.stdout.write("This too");
670
+ *
671
+ * logger.restoreStd(); // Restore original streams
672
+ * ```
673
+ */
689
674
  wrapStd(): void;
690
675
  /**
691
- * Restores the original stdout and stderr streams.
692
- *
693
- * Removes the stream wrapping that was applied by wrapStd(),
694
- * restoring the original stream write methods.
695
- * @example
696
- * ```typescript
697
- * const logger = createPail();
698
- * logger.wrapStd();
699
- * // Streams are wrapped
700
- * logger.restoreStd();
701
- * // Streams are restored to original behavior
702
- * ```
703
- */
676
+ * Restores the original stdout and stderr streams.
677
+ *
678
+ * Removes the stream wrapping that was applied by wrapStd(),
679
+ * restoring the original stream write methods.
680
+ * @example
681
+ * ```typescript
682
+ * const logger = createPail();
683
+ * logger.wrapStd();
684
+ * // Streams are wrapped
685
+ * logger.restoreStd();
686
+ * // Streams are restored to original behavior
687
+ * ```
688
+ */
704
689
  restoreStd(): void;
705
690
  /**
706
- * Wraps all output sources (console and streams).
707
- *
708
- * Convenience method that calls both wrapConsole() and wrapStd()
709
- * to redirect all output through the logger.
710
- * @example
711
- * ```typescript
712
- * const logger = createPail();
713
- * logger.wrapAll(); // Wraps console and streams
714
- *
715
- * // All output now goes through logger
716
- * console.log("Console output");
717
- * process.stdout.write("Stream output");
718
- *
719
- * logger.restoreAll(); // Restore everything
720
- * ```
721
- */
691
+ * Wraps all output sources (console and streams).
692
+ *
693
+ * Convenience method that calls both wrapConsole() and wrapStd()
694
+ * to redirect all output through the logger.
695
+ * @example
696
+ * ```typescript
697
+ * const logger = createPail();
698
+ * logger.wrapAll(); // Wraps console and streams
699
+ *
700
+ * // All output now goes through logger
701
+ * console.log("Console output");
702
+ * process.stdout.write("Stream output");
703
+ *
704
+ * logger.restoreAll(); // Restore everything
705
+ * ```
706
+ */
722
707
  wrapAll(): void;
723
708
  /**
724
- * Restores all wrapped output sources.
725
- *
726
- * Convenience method that calls both restoreConsole() and restoreStd()
727
- * to restore all original output behavior.
728
- * @example
729
- * ```typescript
730
- * const logger = createPail();
731
- * logger.wrapAll();
732
- * // All output is wrapped
733
- * logger.restoreAll();
734
- * // All output sources are restored
735
- * ```
736
- */
709
+ * Restores all wrapped output sources.
710
+ *
711
+ * Convenience method that calls both restoreConsole() and restoreStd()
712
+ * to restore all original output behavior.
713
+ * @example
714
+ * ```typescript
715
+ * const logger = createPail();
716
+ * logger.wrapAll();
717
+ * // All output is wrapped
718
+ * logger.restoreAll();
719
+ * // All output sources are restored
720
+ * ```
721
+ */
737
722
  restoreAll(): void;
738
723
  /**
739
- * Clears the terminal screen.
740
- *
741
- * Sends ANSI escape sequences to clear the terminal screen and move
742
- * the cursor to the top-left position. This overrides the browser
743
- * implementation to work with terminal streams.
744
- * @example
745
- * ```typescript
746
- * const logger = createPail();
747
- * logger.info("Some output");
748
- * logger.clear(); // Clears the terminal screen
749
- * ```
750
- */
724
+ * Clears the terminal screen.
725
+ *
726
+ * Sends ANSI escape sequences to clear the terminal screen and move
727
+ * the cursor to the top-left position. This overrides the browser
728
+ * implementation to work with terminal streams.
729
+ * @example
730
+ * ```typescript
731
+ * const logger = createPail();
732
+ * logger.info("Some output");
733
+ * logger.clear(); // Clears the terminal screen
734
+ * ```
735
+ */
751
736
  override clear(): void;
752
737
  protected override extendReporter(reporter: Reporter<L>): Reporter<L>;
753
738
  }
@@ -755,16 +740,9 @@ type PailServerType<T extends string = string, L extends string = string> = Cons
755
740
  force: Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction>;
756
741
  };
757
742
  /**
758
- * Options for creating a PailError.
759
- *
760
- * Extends standard error properties with self-documenting fields
761
- * that provide actionable context for debugging, particularly useful
762
- * for AI-assisted log analysis.
763
- */
764
- /**
765
- * Create a Pail logger.
766
- * @param options Optional configuration options for the logger
767
- * @returns A configured Pail logger instance
768
- */
743
+ * Create a Pail logger.
744
+ * @param options Optional configuration options for the logger
745
+ * @returns A configured Pail logger instance
746
+ */
769
747
  declare const createPailLogger: (options?: Partial<ConstructorOptions<string, string>>) => PailServerType;
770
748
  export { createPailLogger as default };