@visulima/cerebro 3.0.3 → 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.
- package/CHANGELOG.md +2 -0
- package/dist/commands/completion-command.d.ts +3 -3
- package/dist/commands/completion-command.js +1 -1
- package/dist/commands/help-command.d.ts +1 -1
- package/dist/commands/help-command.js +1 -1
- package/dist/commands/readme-command.d.ts +3 -3
- package/dist/commands/readme-command.js +17 -17
- package/dist/commands/version-command.d.ts +1 -1
- package/dist/index.d.ts +403 -433
- package/dist/index.js +1 -1
- package/dist/logger/create-pail-logger.d.ts +533 -555
- package/dist/packem_chunks/has-new-version.js +1 -1
- package/dist/packem_shared/Cerebro-CHB2i5uf.js +4 -0
- package/dist/packem_shared/{VisulimaError-C90oeIMu.js → VisulimaError-BheWBD7j.js} +2 -2
- package/dist/packem_shared/{cerebro-error-BjBcYVRO.js → cerebro-error-DnA3fjrR.js} +1 -1
- package/dist/packem_shared/command.d-B_G9vIYJ.d.ts +633 -0
- package/dist/packem_shared/{index-DvVGK4kr.js → index-BAKCiGjO.js} +10 -10
- package/dist/packem_shared/index.d-CnnVYgSZ.d.ts +117 -0
- package/dist/packem_shared/renderError-DjesnVYT-pHitCa3e.js +25 -0
- package/dist/packem_shared/split-by-case-DpyL5bdy.js +1 -0
- package/dist/plugins/error-handler-plugin.d.ts +18 -7
- package/dist/plugins/error-handler-plugin.js +1 -1
- package/dist/plugins/runtime-version-check-plugin.d.ts +5 -5
- package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +11 -10
- package/dist/util/general/compile-cache.d.ts +37 -37
- package/dist/util/general/heap-tuning.d.ts +11 -11
- package/dist/util/general/heap-tuning.js +1 -1
- package/package.json +1 -1
- package/dist/packem_shared/Cerebro-Czc4t-75.js +0 -4
- package/dist/packem_shared/command.d-DbhtfXF4.d.ts +0 -639
- package/dist/packem_shared/index.d-BL4NtVR3.d.ts +0 -127
- package/dist/packem_shared/renderError-B3ePOoBG-BmZlyMcr.js +0 -25
- 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
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* @template L -
|
|
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
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
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
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
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
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
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
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
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
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
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
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
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
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
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
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
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
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
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
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
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
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
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
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
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
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
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
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
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
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
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
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
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
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
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
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
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
|
-
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
761
|
-
|
|
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 };
|