@loglayer/mixin-datadog-http-metrics 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -37
- package/dist/index.d.cts +3 -2070
- package/dist/index.d.mts +3 -2070
- package/dist/index.mjs +1 -36
- package/package.json +6 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,2075 +1,6 @@
|
|
|
1
1
|
import metrics, { BufferedMetricsLogger as BufferedMetricsLogger$1, BufferedMetricsLoggerOptions, BufferedMetricsLoggerOptions as BufferedMetricsLoggerOptions$1 } from "datadog-metrics";
|
|
2
|
+
import { LogLayerMixinRegistration } from "loglayer";
|
|
2
3
|
|
|
3
|
-
//#region ../../core/shared/dist/index.d.ts
|
|
4
|
-
//#region src/lazy.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Symbol used to identify lazy values in context and metadata.
|
|
7
|
-
* Can be used to check if a value is a lazy wrapper: `LAZY_SYMBOL in value`.
|
|
8
|
-
*
|
|
9
|
-
* @see {@link https://loglayer.dev/logging-api/lazy-evaluation | Lazy Evaluation Docs}
|
|
10
|
-
*/
|
|
11
|
-
declare const LAZY_SYMBOL: unique symbol;
|
|
12
|
-
/**
|
|
13
|
-
* String constant used as a replacement value when a lazy callback fails during evaluation.
|
|
14
|
-
* Exported so users can programmatically detect lazy evaluation failures in their log output.
|
|
15
|
-
*
|
|
16
|
-
* @see {@link https://loglayer.dev/logging-api/lazy-evaluation#error-handling | Lazy Evaluation Error Handling Docs}
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Represents a lazy value that defers evaluation until log time.
|
|
20
|
-
*
|
|
21
|
-
* Created by the {@link lazy} function.
|
|
22
|
-
*
|
|
23
|
-
* When the type parameter `T` is a `Promise`, log methods that receive this
|
|
24
|
-
* lazy value in metadata will return `Promise<void>` instead of `void`.
|
|
25
|
-
*
|
|
26
|
-
* @see {@link https://loglayer.dev/logging-api/lazy-evaluation | Lazy Evaluation Docs}
|
|
27
|
-
*/
|
|
28
|
-
interface LazyLogValue<T = any> {
|
|
29
|
-
[LAZY_SYMBOL]: () => T;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Wraps a callback function to defer its evaluation until log time.
|
|
33
|
-
*
|
|
34
|
-
* The callback will only be invoked if the log level is enabled,
|
|
35
|
-
* avoiding unnecessary computation for disabled log levels.
|
|
36
|
-
*
|
|
37
|
-
* Can be used in both `withContext()` and `withMetadata()` at the root level.
|
|
38
|
-
*
|
|
39
|
-
* When the callback returns a `Promise` (i.e., is an async function), the
|
|
40
|
-
* log method will return `Promise<void>` so TypeScript can track that the
|
|
41
|
-
* operation is asynchronous.
|
|
42
|
-
*
|
|
43
|
-
* Adapted from [LogTape's lazy evaluation](https://logtape.org/manual/lazy).
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```typescript
|
|
47
|
-
* import { LogLayer, lazy } from "loglayer";
|
|
48
|
-
*
|
|
49
|
-
* const log = new LogLayer({ ... });
|
|
50
|
-
*
|
|
51
|
-
* // Dynamic context - evaluated on each log call
|
|
52
|
-
* log.withContext({
|
|
53
|
-
* memoryUsage: lazy(() => process.memoryUsage().heapUsed),
|
|
54
|
-
* });
|
|
55
|
-
*
|
|
56
|
-
* // Dynamic metadata - evaluated only if debug is enabled
|
|
57
|
-
* log.withMetadata({
|
|
58
|
-
* data: lazy(() => JSON.stringify(largeObject)),
|
|
59
|
-
* }).debug("Processing complete");
|
|
60
|
-
* ```
|
|
61
|
-
*
|
|
62
|
-
* @see {@link https://loglayer.dev/logging-api/lazy-evaluation | Lazy Evaluation Docs}
|
|
63
|
-
*/
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region src/common.types.d.ts
|
|
66
|
-
declare enum LogLevel {
|
|
67
|
-
info = "info",
|
|
68
|
-
warn = "warn",
|
|
69
|
-
error = "error",
|
|
70
|
-
debug = "debug",
|
|
71
|
-
trace = "trace",
|
|
72
|
-
fatal = "fatal"
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Combination of the LogLevel enum and its string representations.
|
|
76
|
-
*/
|
|
77
|
-
type LogLevelType = LogLevel | `${LogLevel}`;
|
|
78
|
-
/**
|
|
79
|
-
* Mapping of log levels to their numeric values.
|
|
80
|
-
*/
|
|
81
|
-
type MessageDataType = string | number | boolean | null | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Options for the `errorOnly` method.
|
|
84
|
-
* @see {@link https://loglayer.dev/logging-api/error-handling.html#error-only-logging | Error Only Logging Doc}
|
|
85
|
-
*/
|
|
86
|
-
interface ErrorOnlyOpts {
|
|
87
|
-
/**
|
|
88
|
-
* Sets the log level of the error
|
|
89
|
-
*/
|
|
90
|
-
logLevel?: LogLevelType;
|
|
91
|
-
/**
|
|
92
|
-
* If `true`, copies the `error.message` if available to the transport library's
|
|
93
|
-
* message property.
|
|
94
|
-
*
|
|
95
|
-
* If the config option `error.copyMsgOnOnlyError` is enabled, this property
|
|
96
|
-
* can be set to `true` to disable the behavior for this specific log entry.
|
|
97
|
-
*/
|
|
98
|
-
copyMsg?: boolean;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Defines the structure for context data that persists across multiple log entries
|
|
102
|
-
* within the same context scope. This is set using log.withContext().
|
|
103
|
-
*/
|
|
104
|
-
interface LogLayerContext extends Record<string, any> {}
|
|
105
|
-
/**
|
|
106
|
-
* Defines the structure for metadata that can be attached to individual log entries.
|
|
107
|
-
* This is set using log.withMetadata() or log.metadataOnly().
|
|
108
|
-
*/
|
|
109
|
-
interface LogLayerMetadata extends Record<string, any> {}
|
|
110
|
-
/**
|
|
111
|
-
* Used internally by LogLayer when assembling the final data object (metadata / context / error) sent to transports.
|
|
112
|
-
*/
|
|
113
|
-
interface LogLayerData extends Record<string, any> {}
|
|
114
|
-
/**
|
|
115
|
-
* Type-level helper that checks whether a metadata/context record type
|
|
116
|
-
* contains any {@link LazyLogValue} whose callback returns a `Promise`.
|
|
117
|
-
*
|
|
118
|
-
* Evaluates to `true` if any property is `LazyLogValue<Promise<any>>`,
|
|
119
|
-
* `false` otherwise. Returns `false` for `undefined` or `null` inputs.
|
|
120
|
-
*
|
|
121
|
-
* @see {@link https://loglayer.dev/logging-api/lazy-evaluation | Lazy Evaluation Docs}
|
|
122
|
-
*/
|
|
123
|
-
type ContainsAsyncLazy<M> = M extends undefined | null ? false : true extends { [K in keyof M]: M[K] extends LazyLogValue<infer T> ? (T extends Promise<any> ? true : false) : false }[keyof M] ? true : false;
|
|
124
|
-
/**
|
|
125
|
-
* Helper type that resolves the return type of log methods based on whether
|
|
126
|
-
* async lazy values are present.
|
|
127
|
-
*
|
|
128
|
-
* - `true` → `Promise<void>` (async lazy values detected)
|
|
129
|
-
* - `false` → `void` (no async lazy values)
|
|
130
|
-
* - `boolean` → `void | Promise<void>` (indeterminate, used by implementation classes)
|
|
131
|
-
*/
|
|
132
|
-
type LogReturnType<IsAsync extends boolean> = IsAsync extends true ? Promise<void> : IsAsync extends false ? void : void | Promise<void>;
|
|
133
|
-
/**
|
|
134
|
-
* Configuration for a single log group.
|
|
135
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
136
|
-
*/
|
|
137
|
-
interface LogGroupConfig {
|
|
138
|
-
/**
|
|
139
|
-
* Array of transport IDs that this group routes to.
|
|
140
|
-
*/
|
|
141
|
-
transports: string[];
|
|
142
|
-
/**
|
|
143
|
-
* Minimum log level for this group. Logs below this level are dropped
|
|
144
|
-
* for this group's transports. Default is "trace" (all levels pass).
|
|
145
|
-
*/
|
|
146
|
-
level?: LogLevelType;
|
|
147
|
-
/**
|
|
148
|
-
* Whether this group is enabled. Default is true.
|
|
149
|
-
*/
|
|
150
|
-
enabled?: boolean;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Map of group names to their configurations.
|
|
154
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
155
|
-
*/
|
|
156
|
-
type LogGroupsConfig = Record<string, LogGroupConfig>;
|
|
157
|
-
interface LogLayerCommonDataParams {
|
|
158
|
-
/**
|
|
159
|
-
* Combined object data containing the metadata, context, and / or error data in a
|
|
160
|
-
* structured format configured by the user.
|
|
161
|
-
*/
|
|
162
|
-
data?: LogLayerData;
|
|
163
|
-
/**
|
|
164
|
-
* Individual metadata object passed to the log message method.
|
|
165
|
-
*/
|
|
166
|
-
metadata?: LogLayerMetadata;
|
|
167
|
-
/**
|
|
168
|
-
* Error passed to the log message method.
|
|
169
|
-
*/
|
|
170
|
-
error?: any;
|
|
171
|
-
/**
|
|
172
|
-
* Context data that is included with each log entry.
|
|
173
|
-
*/
|
|
174
|
-
context?: LogLayerContext;
|
|
175
|
-
} //#endregion
|
|
176
|
-
//#region src/plugin.types.d.ts
|
|
177
|
-
/**
|
|
178
|
-
* Schema information for navigating the assembled log data.
|
|
179
|
-
*
|
|
180
|
-
* Contains the resolved field names used when assembling the log data,
|
|
181
|
-
* so plugins can navigate Data precisely (e.g., find the error map at
|
|
182
|
-
* errorFieldName).
|
|
183
|
-
*
|
|
184
|
-
* @note Only `errorFieldName` is guaranteed to be present. `contextFieldName`
|
|
185
|
-
* and `metadataFieldName` are `undefined` when their respective data is merged
|
|
186
|
-
* at the root level of the data object (i.e., when `contextFieldName` or
|
|
187
|
-
* `metadataFieldName` is not configured in LogLayer).
|
|
188
|
-
*
|
|
189
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html | Creating Plugins}
|
|
190
|
-
*/
|
|
191
|
-
interface LogLayerPluginSchema {
|
|
192
|
-
/**
|
|
193
|
-
* The key under which persistent context data is nested in data.
|
|
194
|
-
* `undefined` when context is merged at root level.
|
|
195
|
-
*/
|
|
196
|
-
contextFieldName?: string;
|
|
197
|
-
/**
|
|
198
|
-
* The key under which per-call metadata is nested in data.
|
|
199
|
-
* `undefined` when metadata is merged at root level.
|
|
200
|
-
*/
|
|
201
|
-
metadataFieldName?: string;
|
|
202
|
-
/**
|
|
203
|
-
* The key under which the serialized error is stored in data.
|
|
204
|
-
* Always populated; defaults to "err".
|
|
205
|
-
*/
|
|
206
|
-
errorFieldName: string;
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Input for the `onBeforeDataOut` plugin lifecycle method.
|
|
210
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforedataout | Creating Plugins}
|
|
211
|
-
*/
|
|
212
|
-
interface PluginBeforeDataOutParams extends LogLayerCommonDataParams {
|
|
213
|
-
/**
|
|
214
|
-
* Log level of the data
|
|
215
|
-
*/
|
|
216
|
-
logLevel: LogLevelType;
|
|
217
|
-
/**
|
|
218
|
-
* The group names this log entry belongs to, if any.
|
|
219
|
-
*
|
|
220
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
221
|
-
*/
|
|
222
|
-
groups?: string[];
|
|
223
|
-
/**
|
|
224
|
-
* Schema information for navigating the assembled data.
|
|
225
|
-
*/
|
|
226
|
-
schema?: LogLayerPluginSchema;
|
|
227
|
-
/**
|
|
228
|
-
* The prefix attached via withPrefix() on the emitting logger (or set
|
|
229
|
-
* via config.prefix). Empty when no prefix was set.
|
|
230
|
-
*/
|
|
231
|
-
prefix?: string;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Input for the `transformLogLevel` plugin lifecycle method.
|
|
235
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#transformloglevel | Creating Plugins}
|
|
236
|
-
*/
|
|
237
|
-
interface PluginTransformLogLevelParams extends LogLayerCommonDataParams {
|
|
238
|
-
/**
|
|
239
|
-
* Log level of the data
|
|
240
|
-
*/
|
|
241
|
-
logLevel: LogLevelType;
|
|
242
|
-
/**
|
|
243
|
-
* Message data that is copied from the original.
|
|
244
|
-
*/
|
|
245
|
-
messages: any[];
|
|
246
|
-
/**
|
|
247
|
-
* The group names this log entry belongs to, if any.
|
|
248
|
-
*
|
|
249
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
250
|
-
*/
|
|
251
|
-
groups?: string[];
|
|
252
|
-
/**
|
|
253
|
-
* Schema information for navigating the assembled data.
|
|
254
|
-
*/
|
|
255
|
-
schema?: LogLayerPluginSchema;
|
|
256
|
-
/**
|
|
257
|
-
* The prefix attached via withPrefix() on the emitting logger (or set
|
|
258
|
-
* via config.prefix). Empty when no prefix was set.
|
|
259
|
-
*/
|
|
260
|
-
prefix?: string;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Input for the `shouldSendToLogger` plugin lifecycle method.
|
|
264
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#shouldsendtologger | Creating Plugins}
|
|
265
|
-
*/
|
|
266
|
-
interface PluginShouldSendToLoggerParams extends LogLayerCommonDataParams {
|
|
267
|
-
/**
|
|
268
|
-
* Unique identifier for the transport. Can be used to not send to a specific transport.
|
|
269
|
-
*/
|
|
270
|
-
transportId?: string;
|
|
271
|
-
/**
|
|
272
|
-
* Message data that is copied from the original.
|
|
273
|
-
*/
|
|
274
|
-
messages: any[];
|
|
275
|
-
/**
|
|
276
|
-
* Log level of the message
|
|
277
|
-
*/
|
|
278
|
-
logLevel: LogLevelType;
|
|
279
|
-
/**
|
|
280
|
-
* The group names this log entry belongs to, if any.
|
|
281
|
-
*
|
|
282
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
283
|
-
*/
|
|
284
|
-
groups?: string[];
|
|
285
|
-
/**
|
|
286
|
-
* Schema information for navigating the assembled data.
|
|
287
|
-
*/
|
|
288
|
-
schema?: LogLayerPluginSchema;
|
|
289
|
-
/**
|
|
290
|
-
* The prefix attached via withPrefix() on the emitting logger (or set
|
|
291
|
-
* via config.prefix). Empty when no prefix was set.
|
|
292
|
-
*/
|
|
293
|
-
prefix?: string;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Input for the `onBeforeMessageOut` plugin lifecycle method.
|
|
297
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforemessageout | Creating Plugins}
|
|
298
|
-
*/
|
|
299
|
-
interface PluginBeforeMessageOutParams {
|
|
300
|
-
/**
|
|
301
|
-
* Log level of the message
|
|
302
|
-
*/
|
|
303
|
-
logLevel: LogLevelType;
|
|
304
|
-
/**
|
|
305
|
-
* Message data that is copied from the original.
|
|
306
|
-
*/
|
|
307
|
-
messages: any[];
|
|
308
|
-
/**
|
|
309
|
-
* The group names this log entry belongs to, if any.
|
|
310
|
-
*
|
|
311
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
312
|
-
*/
|
|
313
|
-
groups?: string[];
|
|
314
|
-
/**
|
|
315
|
-
* Schema information for navigating the assembled data.
|
|
316
|
-
*/
|
|
317
|
-
schema?: LogLayerPluginSchema;
|
|
318
|
-
/**
|
|
319
|
-
* The prefix attached via withPrefix() on the emitting logger (or set
|
|
320
|
-
* via config.prefix). Empty when no prefix was set.
|
|
321
|
-
*/
|
|
322
|
-
prefix?: string;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Parameters for creating a LogLayer plugin.
|
|
326
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html | Creating Plugins}
|
|
327
|
-
*/
|
|
328
|
-
interface LogLayerPluginParams {
|
|
329
|
-
/**
|
|
330
|
-
* Unique identifier for the plugin. Used for selectively disabling / enabling
|
|
331
|
-
* and removing the plugin. If not defined, a randomly generated ID will be used.
|
|
332
|
-
*/
|
|
333
|
-
id?: string;
|
|
334
|
-
/**
|
|
335
|
-
* If true, the plugin will skip execution
|
|
336
|
-
*/
|
|
337
|
-
disabled?: boolean;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Interface for implementing a LogLayer plugin.
|
|
341
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html | Creating Plugins}
|
|
342
|
-
*/
|
|
343
|
-
interface LogLayerPlugin extends LogLayerPluginParams {
|
|
344
|
-
/**
|
|
345
|
-
* Called after `onBeforeDataOut` and `onBeforeMessageOut` but before `shouldSendToLogger` to transform the log level.
|
|
346
|
-
* This allows you to change the log level based on the processed log data, metadata, context, error, or messages.
|
|
347
|
-
*
|
|
348
|
-
* - The shape of `data` varies depending on your `fieldName` configuration
|
|
349
|
-
* for metadata / context / error. The metadata / context / error data is a *shallow* clone.
|
|
350
|
-
* - If data was not found for assembly, `undefined` is used as the `data` input.
|
|
351
|
-
* - The `data` parameter will contain any modifications made by `onBeforeDataOut` plugins.
|
|
352
|
-
* - The `messages` parameter will contain any modifications made by `onBeforeMessageOut` plugins.
|
|
353
|
-
* - If multiple plugins define `transformLogLevel`, the last one that returns a valid log level wins.
|
|
354
|
-
*
|
|
355
|
-
* @returns [LogLevelType] The log level to use for the log. Returning null, undefined, or false
|
|
356
|
-
* will use the log level originally specified.
|
|
357
|
-
*
|
|
358
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#transformloglevel | Creating Plugins}
|
|
359
|
-
*/
|
|
360
|
-
transformLogLevel?(params: PluginTransformLogLevelParams, loglayer: ILogLayer): LogLevelType | null | undefined | false;
|
|
361
|
-
/**
|
|
362
|
-
* Called after the assembly of the data object that contains
|
|
363
|
-
* the metadata / context / error data before being sent to the destination logging
|
|
364
|
-
* library.
|
|
365
|
-
*
|
|
366
|
-
* - The shape of `data` varies depending on your `fieldName` configuration
|
|
367
|
-
* for metadata / context / error. The metadata / context / error data is a *shallow* clone.
|
|
368
|
-
* - If data was not found for assembly, `undefined` is used as the `data` input.
|
|
369
|
-
* - You can also create your own object and return it to be sent to the logging library.
|
|
370
|
-
*
|
|
371
|
-
* @returns [Object] The object to be sent to the destination logging
|
|
372
|
-
* library or null / undefined to not pass an object through.
|
|
373
|
-
*
|
|
374
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforedataout | Creating Plugins}
|
|
375
|
-
*/
|
|
376
|
-
onBeforeDataOut?(params: PluginBeforeDataOutParams, loglayer: ILogLayer): LogLayerData | null | undefined;
|
|
377
|
-
/**
|
|
378
|
-
* Called after `onBeforeDataOut` and before `shouldSendToLogger`.
|
|
379
|
-
* This allows you to modify the message data before it is sent to the destination logging library.
|
|
380
|
-
*
|
|
381
|
-
* @returns [Array] The message data to be sent to the destination logging library.
|
|
382
|
-
*
|
|
383
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforemessageout | Creating Plugins}
|
|
384
|
-
*/
|
|
385
|
-
onBeforeMessageOut?(params: PluginBeforeMessageOutParams, loglayer: ILogLayer): any[];
|
|
386
|
-
/**
|
|
387
|
-
* Called before the data is sent to the transport. Return false to omit sending
|
|
388
|
-
* to the transport. Useful for isolating specific log messages for debugging /
|
|
389
|
-
* troubleshooting.
|
|
390
|
-
*
|
|
391
|
-
* If there are multiple plugins with shouldSendToLogger defined, the
|
|
392
|
-
* first plugin to return false will stop the data from being sent to the
|
|
393
|
-
* transport.
|
|
394
|
-
*
|
|
395
|
-
* @returns boolean If true, sends data to the transport, if false does not.
|
|
396
|
-
*
|
|
397
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#shouldsendtologger | Creating Plugins}
|
|
398
|
-
*/
|
|
399
|
-
shouldSendToLogger?(params: PluginShouldSendToLoggerParams, loglayer: ILogLayer): boolean;
|
|
400
|
-
/**
|
|
401
|
-
* Called when withMetadata() or metadataOnly() is called. This allows you to modify the metadata before it is sent to the destination logging library.
|
|
402
|
-
*
|
|
403
|
-
* The metadata is a *shallow* clone of the metadata input.
|
|
404
|
-
*
|
|
405
|
-
* If null is returned, then no metadata will be sent to the destination logging library.
|
|
406
|
-
*
|
|
407
|
-
* In multiple plugins, the modified metadata will be passed through each plugin in the order they are added.
|
|
408
|
-
*
|
|
409
|
-
* @returns [Object] The metadata object to be sent to the destination logging library.
|
|
410
|
-
*
|
|
411
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onmetadatacalled | Creating Plugins}
|
|
412
|
-
*/
|
|
413
|
-
onMetadataCalled?: (metadata: LogLayerMetadata, loglayer: ILogLayer) => LogLayerMetadata | null | undefined;
|
|
414
|
-
/**
|
|
415
|
-
* Called when withContext() is called. This allows you to modify the context before it is used.
|
|
416
|
-
*
|
|
417
|
-
* The context is a *shallow* clone of the context input.
|
|
418
|
-
*
|
|
419
|
-
* If null is returned, then no context will be used.
|
|
420
|
-
*
|
|
421
|
-
* In multiple plugins, the modified context will be passed through each plugin in the order they are added.
|
|
422
|
-
*
|
|
423
|
-
* @returns [Object] The context object to be used.
|
|
424
|
-
*
|
|
425
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#oncontextcalled | Creating Plugins}
|
|
426
|
-
*/
|
|
427
|
-
onContextCalled?: (context: LogLayerContext, loglayer: ILogLayer) => LogLayerContext | null | undefined;
|
|
428
|
-
} //#endregion
|
|
429
|
-
//#region src/loglayer.types.d.ts
|
|
430
|
-
/**
|
|
431
|
-
* Interface for raw log entries that allows complete control over all aspects of a log entry.
|
|
432
|
-
*
|
|
433
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#raw-logging | Raw Logging Documentation}
|
|
434
|
-
*/
|
|
435
|
-
interface RawLogEntry {
|
|
436
|
-
/**
|
|
437
|
-
* Context data to include with the log entry.
|
|
438
|
-
*
|
|
439
|
-
* - When provided, this context data will be used instead of the context manager.
|
|
440
|
-
* - If not provided, the context manager data will be used instead
|
|
441
|
-
* - An empty object will result in no context data being used at all
|
|
442
|
-
*/
|
|
443
|
-
context?: LogLayerContext;
|
|
444
|
-
/**
|
|
445
|
-
* Metadata to include with the log entry.
|
|
446
|
-
*/
|
|
447
|
-
metadata?: LogLayerMetadata;
|
|
448
|
-
/**
|
|
449
|
-
* Data to spread directly at the root level of the log entry.
|
|
450
|
-
*
|
|
451
|
-
* Unlike `metadata`, this bypasses `metadataFieldName` / `contextFieldName`
|
|
452
|
-
* nesting and is always flattened at the root of the emitted log object.
|
|
453
|
-
*
|
|
454
|
-
* Note: Unlike `metadata`, `rootData` does not support lazy evaluation.
|
|
455
|
-
*/
|
|
456
|
-
rootData?: LogLayerMetadata;
|
|
457
|
-
/**
|
|
458
|
-
* Error object to include with the log entry.
|
|
459
|
-
*/
|
|
460
|
-
error?: any;
|
|
461
|
-
/**
|
|
462
|
-
* The log level for this entry.
|
|
463
|
-
*/
|
|
464
|
-
logLevel: LogLevelType;
|
|
465
|
-
/**
|
|
466
|
-
* Array of message parameters to log.
|
|
467
|
-
*
|
|
468
|
-
* These are the actual log messages and can include strings, numbers,
|
|
469
|
-
* booleans, null, or undefined values. The first string message will
|
|
470
|
-
* have any configured prefix applied to it.
|
|
471
|
-
*/
|
|
472
|
-
messages?: MessageDataType[];
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Context Manager callback function for when a child logger is created.
|
|
476
|
-
* @see {@link https://loglayer.dev/context-managers/creating-context-managers.html | Creating Context Managers Docs}
|
|
477
|
-
*/
|
|
478
|
-
interface OnChildLoggerCreatedParams {
|
|
479
|
-
/**
|
|
480
|
-
* The parent logger instance
|
|
481
|
-
*/
|
|
482
|
-
parentLogger: ILogLayer<any>;
|
|
483
|
-
/**
|
|
484
|
-
* The child logger instance
|
|
485
|
-
*/
|
|
486
|
-
childLogger: ILogLayer<any>;
|
|
487
|
-
/**
|
|
488
|
-
* The parent logger's context manager
|
|
489
|
-
*/
|
|
490
|
-
parentContextManager: IContextManager;
|
|
491
|
-
/**
|
|
492
|
-
* The child logger's context manager
|
|
493
|
-
*/
|
|
494
|
-
childContextManager: IContextManager;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Interface for implementing a context manager instance.
|
|
498
|
-
*
|
|
499
|
-
* If your context manager needs to clean up resources (like file handles, memory, or external connections),
|
|
500
|
-
* you can optionally implement the {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management | Disposable} interface.
|
|
501
|
-
* LogLayer will automatically call the dispose method when the context manager is replaced using `withContextManager()`.
|
|
502
|
-
*
|
|
503
|
-
* @see {@link https://loglayer.dev/context-managers/creating-context-managers.html | Creating Context Managers Docs}
|
|
504
|
-
*/
|
|
505
|
-
interface IContextManager {
|
|
506
|
-
/**
|
|
507
|
-
* Sets the context data to be included with every log entry. Set to `undefined` to clear the context data.
|
|
508
|
-
*/
|
|
509
|
-
setContext(context?: LogLayerContext): void;
|
|
510
|
-
/**
|
|
511
|
-
* Appends context data to the existing context data.
|
|
512
|
-
*/
|
|
513
|
-
appendContext(context: Partial<LogLayerContext>): void;
|
|
514
|
-
/**
|
|
515
|
-
* Returns the context data to be included with every log entry.
|
|
516
|
-
*/
|
|
517
|
-
getContext(): LogLayerContext;
|
|
518
|
-
/**
|
|
519
|
-
* Returns true if context data is present.
|
|
520
|
-
*/
|
|
521
|
-
hasContextData(): boolean;
|
|
522
|
-
/**
|
|
523
|
-
* Clears the context data. If keys are provided, only those keys will be removed.
|
|
524
|
-
* If no keys are provided, all context data will be cleared.
|
|
525
|
-
*/
|
|
526
|
-
clearContext(keys?: string | string[]): void;
|
|
527
|
-
/**
|
|
528
|
-
* Called when a child logger is created. Use to manipulate context data between parent and child.
|
|
529
|
-
*/
|
|
530
|
-
onChildLoggerCreated(params: OnChildLoggerCreatedParams): void;
|
|
531
|
-
/**
|
|
532
|
-
* Creates a new instance of the context manager with the same context data.
|
|
533
|
-
*/
|
|
534
|
-
clone(): IContextManager;
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Log Level Manager callback function for when a child logger is created.
|
|
538
|
-
*/
|
|
539
|
-
interface OnChildLogLevelManagerCreatedParams {
|
|
540
|
-
/**
|
|
541
|
-
* The parent logger instance
|
|
542
|
-
*/
|
|
543
|
-
parentLogger: ILogLayer<any>;
|
|
544
|
-
/**
|
|
545
|
-
* The child logger instance
|
|
546
|
-
*/
|
|
547
|
-
childLogger: ILogLayer<any>;
|
|
548
|
-
/**
|
|
549
|
-
* The parent logger's log level manager
|
|
550
|
-
*/
|
|
551
|
-
parentLogLevelManager: ILogLevelManager;
|
|
552
|
-
/**
|
|
553
|
-
* The child logger's log level manager
|
|
554
|
-
*/
|
|
555
|
-
childLogLevelManager: ILogLevelManager;
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Interface for implementing a log level manager instance.
|
|
559
|
-
*
|
|
560
|
-
* Log level managers are responsible for managing log level settings across logger instances.
|
|
561
|
-
* They control how log levels are inherited and propagated between parent and child loggers.
|
|
562
|
-
*
|
|
563
|
-
* If your log level manager needs to clean up resources (like parent-child references, memory, or external connections),
|
|
564
|
-
* you can optionally implement the {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management | Disposable} interface.
|
|
565
|
-
* LogLayer will automatically call the dispose method when the log level manager is replaced using `withLogLevelManager()`.
|
|
566
|
-
*
|
|
567
|
-
* @see {@link https://loglayer.dev/log-level-managers/creating-log-level-managers.html | Creating Log Level Managers Docs}
|
|
568
|
-
*/
|
|
569
|
-
interface ILogLevelManager {
|
|
570
|
-
/**
|
|
571
|
-
* Sets the minimum log level to be used by the logger. Only messages with
|
|
572
|
-
* this level or higher severity will be logged.
|
|
573
|
-
*
|
|
574
|
-
* **When triggered:** Called when `logger.setLevel()` is invoked on a LogLayer instance.
|
|
575
|
-
*/
|
|
576
|
-
setLevel(logLevel: LogLevelType): void;
|
|
577
|
-
/**
|
|
578
|
-
* Enables a specific log level.
|
|
579
|
-
*
|
|
580
|
-
* **When triggered:** Called when `logger.enableIndividualLevel()` is invoked on a LogLayer instance.
|
|
581
|
-
*/
|
|
582
|
-
enableIndividualLevel(logLevel: LogLevelType): void;
|
|
583
|
-
/**
|
|
584
|
-
* Disables a specific log level.
|
|
585
|
-
*
|
|
586
|
-
* **When triggered:** Called when `logger.disableIndividualLevel()` is invoked on a LogLayer instance.
|
|
587
|
-
*/
|
|
588
|
-
disableIndividualLevel(logLevel: LogLevelType): void;
|
|
589
|
-
/**
|
|
590
|
-
* Checks if a specific log level is enabled.
|
|
591
|
-
*
|
|
592
|
-
* **When triggered:** Called before every log method execution (e.g., `info()`, `warn()`, `error()`, `debug()`, `trace()`, `fatal()`, `raw()`, `metadataOnly()`, `errorOnly()`) to determine if the log should be processed. Also called when `logger.isLevelEnabled()` is invoked directly.
|
|
593
|
-
*/
|
|
594
|
-
isLevelEnabled(logLevel: LogLevelType): boolean;
|
|
595
|
-
/**
|
|
596
|
-
* Enable sending logs to the logging library.
|
|
597
|
-
*
|
|
598
|
-
* **When triggered:** Called when `logger.enableLogging()` is invoked on a LogLayer instance.
|
|
599
|
-
*/
|
|
600
|
-
enableLogging(): void;
|
|
601
|
-
/**
|
|
602
|
-
* All logging inputs are dropped and stops sending logs to the logging library.
|
|
603
|
-
*
|
|
604
|
-
* **When triggered:** Called when `logger.disableLogging()` is invoked on a LogLayer instance, or when a LogLayer instance is created with `enabled: false` in the configuration.
|
|
605
|
-
*/
|
|
606
|
-
disableLogging(): void;
|
|
607
|
-
/**
|
|
608
|
-
* Called when a child logger is created. Use to manipulate log level settings between parent and child.
|
|
609
|
-
*
|
|
610
|
-
* **When triggered:** Called automatically when `logger.child()` is invoked, after the child logger is created and the parent's log level manager has been cloned. This allows the manager to establish relationships between parent and child loggers.
|
|
611
|
-
*/
|
|
612
|
-
onChildLoggerCreated(params: OnChildLogLevelManagerCreatedParams): void;
|
|
613
|
-
/**
|
|
614
|
-
* Creates a new instance of the log level manager with the same log level settings.
|
|
615
|
-
*
|
|
616
|
-
* **When triggered:** Called automatically when `logger.child()` is invoked to create a new log level manager instance for the child logger. The cloned instance should have the same initial log level state as the parent, but can be modified independently (unless the manager implements shared state behavior).
|
|
617
|
-
*/
|
|
618
|
-
clone(): ILogLevelManager;
|
|
619
|
-
}
|
|
620
|
-
/**
|
|
621
|
-
* Input to the LogLayer transport shipToLogger() method.
|
|
622
|
-
* @see {@link https://loglayer.dev/transports/creating-transports.html | Creating Transports Docs}
|
|
623
|
-
*/
|
|
624
|
-
interface LogLayerTransportParams extends LogLayerCommonDataParams {
|
|
625
|
-
/**
|
|
626
|
-
* The log level of the message
|
|
627
|
-
*/
|
|
628
|
-
logLevel: LogLevelType;
|
|
629
|
-
/**
|
|
630
|
-
* The parameters that were passed to the log message method (eg: info / warn / debug / error)
|
|
631
|
-
*/
|
|
632
|
-
messages: any[];
|
|
633
|
-
/**
|
|
634
|
-
* If true, the data object is included in the message parameters
|
|
635
|
-
*/
|
|
636
|
-
hasData?: boolean;
|
|
637
|
-
/**
|
|
638
|
-
* The group names this log entry belongs to, if any.
|
|
639
|
-
*
|
|
640
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
641
|
-
*/
|
|
642
|
-
groups?: string[];
|
|
643
|
-
/**
|
|
644
|
-
* Schema information for navigating the assembled data.
|
|
645
|
-
*/
|
|
646
|
-
schema?: LogLayerPluginSchema;
|
|
647
|
-
/**
|
|
648
|
-
* The prefix attached via withPrefix() on the emitting logger (or set
|
|
649
|
-
* via config.prefix). Empty when no prefix was set.
|
|
650
|
-
*/
|
|
651
|
-
prefix?: string;
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Interface for implementing a LogLayer transport instance.
|
|
655
|
-
* @see {@link https://loglayer.dev/transports/creating-transports.html | Creating Transports Docs}
|
|
656
|
-
*/
|
|
657
|
-
interface LogLayerTransport<LogLibrary = any> {
|
|
658
|
-
/**
|
|
659
|
-
* A user-defined identifier for the transport
|
|
660
|
-
**/
|
|
661
|
-
id?: string;
|
|
662
|
-
/**
|
|
663
|
-
* If false, the transport will not send logs to the logger.
|
|
664
|
-
* Default is true.
|
|
665
|
-
*/
|
|
666
|
-
enabled?: boolean;
|
|
667
|
-
/**
|
|
668
|
-
* Sends the log data to the logger for transport
|
|
669
|
-
*/
|
|
670
|
-
shipToLogger(params: LogLayerTransportParams): any[];
|
|
671
|
-
/**
|
|
672
|
-
* Internal use only. Do not implement.
|
|
673
|
-
* @param params
|
|
674
|
-
*/
|
|
675
|
-
_sendToLogger(params: LogLayerTransportParams): void;
|
|
676
|
-
/**
|
|
677
|
-
* Returns the logger instance attached to the transport
|
|
678
|
-
*/
|
|
679
|
-
getLoggerInstance(): LogLibrary;
|
|
680
|
-
}
|
|
681
|
-
/**
|
|
682
|
-
* Interface for implementing a LogLayer builder instance.
|
|
683
|
-
*
|
|
684
|
-
* @typeParam This - The concrete builder type for polymorphic chaining.
|
|
685
|
-
* @typeParam IsAsync - Whether the builder contains async lazy metadata.
|
|
686
|
-
* When `true`, log methods return `Promise<void>`. When `false`, they return `void`.
|
|
687
|
-
* When `boolean` (indeterminate), they return `void | Promise<void>`.
|
|
688
|
-
*
|
|
689
|
-
* @see {@link https://loglayer.dev | LogLayer Documentation}
|
|
690
|
-
*/
|
|
691
|
-
interface ILogBuilder<This = ILogBuilder<any, any>, IsAsync extends boolean = false> {
|
|
692
|
-
/**
|
|
693
|
-
* Sends a log message to the logging library under an info log level.
|
|
694
|
-
* Returns a Promise when async lazy values are present in metadata.
|
|
695
|
-
*
|
|
696
|
-
* Supports tagged template syntax:
|
|
697
|
-
* ```typescript
|
|
698
|
-
* log.withMetadata({ userId }).info`User ${userId} logged in`;
|
|
699
|
-
* ```
|
|
700
|
-
*/
|
|
701
|
-
info(strings: TemplateStringsArray, ...values: any[]): LogReturnType<IsAsync>;
|
|
702
|
-
info(...messages: MessageDataType[]): LogReturnType<IsAsync>;
|
|
703
|
-
/**
|
|
704
|
-
* Sends a log message to the logging library under the warn log level.
|
|
705
|
-
* Returns a Promise when async lazy values are present in metadata.
|
|
706
|
-
*
|
|
707
|
-
* Supports tagged template syntax:
|
|
708
|
-
* ```typescript
|
|
709
|
-
* log.withMetadata({ requestId }).warn`Request ${requestId} timed out`;
|
|
710
|
-
* ```
|
|
711
|
-
*/
|
|
712
|
-
warn(strings: TemplateStringsArray, ...values: any[]): LogReturnType<IsAsync>;
|
|
713
|
-
warn(...messages: MessageDataType[]): LogReturnType<IsAsync>;
|
|
714
|
-
/**
|
|
715
|
-
* Sends a log message to the logging library under the error log level.
|
|
716
|
-
* Returns a Promise when async lazy values are present in metadata.
|
|
717
|
-
*
|
|
718
|
-
* Supports tagged template syntax:
|
|
719
|
-
* ```typescript
|
|
720
|
-
* log.withError(err).error`Failed to process ${taskId}`;
|
|
721
|
-
* ```
|
|
722
|
-
*/
|
|
723
|
-
error(strings: TemplateStringsArray, ...values: any[]): LogReturnType<IsAsync>;
|
|
724
|
-
error(...messages: MessageDataType[]): LogReturnType<IsAsync>;
|
|
725
|
-
/**
|
|
726
|
-
* Sends a log message to the logging library under the debug log level.
|
|
727
|
-
* Returns a Promise when async lazy values are present in metadata.
|
|
728
|
-
*
|
|
729
|
-
* Supports tagged template syntax:
|
|
730
|
-
* ```typescript
|
|
731
|
-
* log.withMetadata({ cacheKey }).debug`Cache hit for ${cacheKey}`;
|
|
732
|
-
* ```
|
|
733
|
-
*/
|
|
734
|
-
debug(strings: TemplateStringsArray, ...values: any[]): LogReturnType<IsAsync>;
|
|
735
|
-
debug(...messages: MessageDataType[]): LogReturnType<IsAsync>;
|
|
736
|
-
/**
|
|
737
|
-
* Sends a log message to the logging library under the trace log level.
|
|
738
|
-
* Returns a Promise when async lazy values are present in metadata.
|
|
739
|
-
*
|
|
740
|
-
* Supports tagged template syntax:
|
|
741
|
-
* ```typescript
|
|
742
|
-
* log.withMetadata({ functionName }).trace`Entering ${functionName}`;
|
|
743
|
-
* ```
|
|
744
|
-
*/
|
|
745
|
-
trace(strings: TemplateStringsArray, ...values: any[]): LogReturnType<IsAsync>;
|
|
746
|
-
trace(...messages: MessageDataType[]): LogReturnType<IsAsync>;
|
|
747
|
-
/**
|
|
748
|
-
* Sends a log message to the logging library under the fatal log level.
|
|
749
|
-
* Returns a Promise when async lazy values are present in metadata.
|
|
750
|
-
*
|
|
751
|
-
* Supports tagged template syntax:
|
|
752
|
-
* ```typescript
|
|
753
|
-
* log.withError(err).fatal`System crash: ${reason}`;
|
|
754
|
-
* ```
|
|
755
|
-
*/
|
|
756
|
-
fatal(strings: TemplateStringsArray, ...values: any[]): LogReturnType<IsAsync>;
|
|
757
|
-
fatal(...messages: MessageDataType[]): LogReturnType<IsAsync>;
|
|
758
|
-
/**
|
|
759
|
-
* Specifies metadata to include with the log message.
|
|
760
|
-
* If the metadata contains async lazy values, subsequent log methods will return `Promise<void>`.
|
|
761
|
-
*
|
|
762
|
-
* @see {@link https://loglayer.dev/logging-api/metadata.html | Metadata Docs}
|
|
763
|
-
*/
|
|
764
|
-
withMetadata<M extends LogLayerMetadata>(metadata?: M): ILogBuilder<This, ContainsAsyncLazy<NonNullable<M>> extends true ? true : IsAsync>;
|
|
765
|
-
/**
|
|
766
|
-
* Specifies an Error to include with the log message
|
|
767
|
-
*
|
|
768
|
-
* @see {@link https://loglayer.dev/logging-api/error-handling.html | Error Handling Docs}
|
|
769
|
-
*/
|
|
770
|
-
withError(error: any): ILogBuilder<This, IsAsync>;
|
|
771
|
-
/**
|
|
772
|
-
* Tags this log entry with one or more groups for routing.
|
|
773
|
-
*
|
|
774
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
775
|
-
*/
|
|
776
|
-
withGroup(group: string | string[]): ILogBuilder<This, IsAsync>;
|
|
777
|
-
/**
|
|
778
|
-
* Enable sending logs to the logging library.
|
|
779
|
-
*
|
|
780
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
781
|
-
*/
|
|
782
|
-
enableLogging(): ILogBuilder<This, IsAsync>;
|
|
783
|
-
/**
|
|
784
|
-
* All logging inputs are dropped and stops sending logs to the logging library.
|
|
785
|
-
*
|
|
786
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
787
|
-
*/
|
|
788
|
-
disableLogging(): ILogBuilder<This, IsAsync>;
|
|
789
|
-
}
|
|
790
|
-
/**
|
|
791
|
-
* Interface for implementing a LogLayer logger instance.
|
|
792
|
-
* @see {@link https://loglayer.dev | LogLayer Documentation}
|
|
793
|
-
*/
|
|
794
|
-
interface ILogLayer<This = ILogLayer<any>> {
|
|
795
|
-
/**
|
|
796
|
-
* Sends a log message to the logging library under an info log level.
|
|
797
|
-
*
|
|
798
|
-
* Supports tagged template syntax:
|
|
799
|
-
* ```typescript
|
|
800
|
-
* log.info`User ${userId} logged in`;
|
|
801
|
-
* ```
|
|
802
|
-
*/
|
|
803
|
-
info(strings: TemplateStringsArray, ...values: any[]): void;
|
|
804
|
-
info(...messages: MessageDataType[]): void;
|
|
805
|
-
/**
|
|
806
|
-
* Sends a log message to the logging library under the warn log level.
|
|
807
|
-
*
|
|
808
|
-
* Supports tagged template syntax:
|
|
809
|
-
* ```typescript
|
|
810
|
-
* log.warn`Request ${requestId} timed out`;
|
|
811
|
-
* ```
|
|
812
|
-
*/
|
|
813
|
-
warn(strings: TemplateStringsArray, ...values: any[]): void;
|
|
814
|
-
warn(...messages: MessageDataType[]): void;
|
|
815
|
-
/**
|
|
816
|
-
* Sends a log message to the logging library under the error log level.
|
|
817
|
-
*
|
|
818
|
-
* Supports tagged template syntax:
|
|
819
|
-
* ```typescript
|
|
820
|
-
* log.error`Failed to process ${taskId}`;
|
|
821
|
-
* ```
|
|
822
|
-
*/
|
|
823
|
-
error(strings: TemplateStringsArray, ...values: any[]): void;
|
|
824
|
-
error(...messages: MessageDataType[]): void;
|
|
825
|
-
/**
|
|
826
|
-
* Sends a log message to the logging library under the debug log level.
|
|
827
|
-
*
|
|
828
|
-
* Supports tagged template syntax:
|
|
829
|
-
* ```typescript
|
|
830
|
-
* log.debug`Cache hit for ${cacheKey}`;
|
|
831
|
-
* ```
|
|
832
|
-
*/
|
|
833
|
-
debug(strings: TemplateStringsArray, ...values: any[]): void;
|
|
834
|
-
debug(...messages: MessageDataType[]): void;
|
|
835
|
-
/**
|
|
836
|
-
* Sends a log message to the logging library under the trace log level.
|
|
837
|
-
*
|
|
838
|
-
* Supports tagged template syntax:
|
|
839
|
-
* ```typescript
|
|
840
|
-
* log.trace`Entering ${functionName}`;
|
|
841
|
-
* ```
|
|
842
|
-
*/
|
|
843
|
-
trace(strings: TemplateStringsArray, ...values: any[]): void;
|
|
844
|
-
trace(...messages: MessageDataType[]): void;
|
|
845
|
-
/**
|
|
846
|
-
* Sends a log message to the logging library under the fatal log level.
|
|
847
|
-
*
|
|
848
|
-
* Supports tagged template syntax:
|
|
849
|
-
* ```typescript
|
|
850
|
-
* log.fatal`System crash: ${reason}`;
|
|
851
|
-
* ```
|
|
852
|
-
*/
|
|
853
|
-
fatal(strings: TemplateStringsArray, ...values: any[]): void;
|
|
854
|
-
fatal(...messages: MessageDataType[]): void;
|
|
855
|
-
/**
|
|
856
|
-
* Specifies metadata to include with the log message.
|
|
857
|
-
* If the metadata contains async lazy values, the builder's log methods will return `Promise<void>`.
|
|
858
|
-
*
|
|
859
|
-
* @see {@link https://loglayer.dev/logging-api/metadata.html | Metadata Docs}
|
|
860
|
-
*/
|
|
861
|
-
withMetadata<M extends LogLayerMetadata>(metadata?: M): ILogBuilder<any, ContainsAsyncLazy<NonNullable<M>>>;
|
|
862
|
-
/**
|
|
863
|
-
* Specifies an Error to include with the log message
|
|
864
|
-
*
|
|
865
|
-
* @see {@link https://loglayer.dev/logging-api/error-handling.html | Error Handling Docs}
|
|
866
|
-
*/
|
|
867
|
-
withError(error: any): ILogBuilder<any, false>;
|
|
868
|
-
/**
|
|
869
|
-
* Enable sending logs to the logging library.
|
|
870
|
-
*
|
|
871
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
872
|
-
*/
|
|
873
|
-
enableLogging(): This;
|
|
874
|
-
/**
|
|
875
|
-
* All logging inputs are dropped and stops sending logs to the logging library.
|
|
876
|
-
*
|
|
877
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
878
|
-
*/
|
|
879
|
-
disableLogging(): This;
|
|
880
|
-
/**
|
|
881
|
-
* Calls child() and sets the prefix to be included with every log message.
|
|
882
|
-
*
|
|
883
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#message-prefixing | Message Prefixing Docs}
|
|
884
|
-
*/
|
|
885
|
-
withPrefix(string: string): This;
|
|
886
|
-
/**
|
|
887
|
-
* Creates a child logger with the specified group(s) persistently assigned.
|
|
888
|
-
* All logs from the child will be tagged with these groups.
|
|
889
|
-
*
|
|
890
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
891
|
-
*/
|
|
892
|
-
withGroup(group: string | string[]): This;
|
|
893
|
-
/**
|
|
894
|
-
* Adds a new group definition at runtime.
|
|
895
|
-
*
|
|
896
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
897
|
-
*/
|
|
898
|
-
addGroup(name: string, config: LogGroupConfig): This;
|
|
899
|
-
/**
|
|
900
|
-
* Removes a group definition at runtime.
|
|
901
|
-
*
|
|
902
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
903
|
-
*/
|
|
904
|
-
removeGroup(name: string): This;
|
|
905
|
-
/**
|
|
906
|
-
* Enables a group by name (sets enabled: true).
|
|
907
|
-
*
|
|
908
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
909
|
-
*/
|
|
910
|
-
enableGroup(name: string): This;
|
|
911
|
-
/**
|
|
912
|
-
* Disables a group by name (sets enabled: false). Logs tagged with a disabled
|
|
913
|
-
* group will not be routed through that group.
|
|
914
|
-
*
|
|
915
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
916
|
-
*/
|
|
917
|
-
disableGroup(name: string): This;
|
|
918
|
-
/**
|
|
919
|
-
* Sets the minimum log level for a group at runtime.
|
|
920
|
-
*
|
|
921
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
922
|
-
*/
|
|
923
|
-
setGroupLevel(name: string, level: LogLevelType): This;
|
|
924
|
-
/**
|
|
925
|
-
* Sets which groups are active. Only active groups will route logs.
|
|
926
|
-
* Pass null to clear the filter (all groups active).
|
|
927
|
-
*
|
|
928
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
929
|
-
*/
|
|
930
|
-
setActiveGroups(groups: string[] | null): This;
|
|
931
|
-
/**
|
|
932
|
-
* Returns a snapshot of all group configurations.
|
|
933
|
-
*
|
|
934
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
935
|
-
*/
|
|
936
|
-
getGroups(): LogGroupsConfig;
|
|
937
|
-
/**
|
|
938
|
-
* Appends context data which will be included with
|
|
939
|
-
* every log entry.
|
|
940
|
-
*
|
|
941
|
-
* Passing in an empty value / object will *not* clear the context.
|
|
942
|
-
*
|
|
943
|
-
* To clear the context, use {@link clearContext}.
|
|
944
|
-
*
|
|
945
|
-
* @see {@link https://loglayer.dev/logging-api/context.html | Context Docs}
|
|
946
|
-
*/
|
|
947
|
-
withContext(context?: LogLayerContext): This;
|
|
948
|
-
/**
|
|
949
|
-
* Clears the context data. If keys are provided, only those keys will be removed.
|
|
950
|
-
* If no keys are provided, all context data will be cleared.
|
|
951
|
-
*
|
|
952
|
-
* @see {@link https://loglayer.dev/logging-api/context.html | Context Docs}
|
|
953
|
-
*/
|
|
954
|
-
clearContext(keys?: string | string[]): This;
|
|
955
|
-
/**
|
|
956
|
-
* Logs only the error object without a log message
|
|
957
|
-
*
|
|
958
|
-
* @see {@link https://loglayer.dev/logging-api/error-handling.html | Error Handling Docs}
|
|
959
|
-
*/
|
|
960
|
-
errorOnly(error: any, opts?: ErrorOnlyOpts): void;
|
|
961
|
-
/**
|
|
962
|
-
* Logs only metadata without a log message.
|
|
963
|
-
* Returns a Promise when async lazy values are present in metadata.
|
|
964
|
-
*
|
|
965
|
-
* @see {@link https://loglayer.dev/logging-api/metadata.html | Metadata Docs}
|
|
966
|
-
*/
|
|
967
|
-
metadataOnly<M extends LogLayerMetadata>(metadata?: M, logLevel?: LogLevelType): LogReturnType<ContainsAsyncLazy<NonNullable<M>>>;
|
|
968
|
-
/**
|
|
969
|
-
* Returns the context used.
|
|
970
|
-
* By default, lazy values are resolved before returning.
|
|
971
|
-
* Pass `{ raw: true }` to return the raw lazy wrappers without resolving them.
|
|
972
|
-
* Async lazy values in context are not supported and will be replaced with `"[LazyEvalError]"`.
|
|
973
|
-
*
|
|
974
|
-
* @see {@link https://loglayer.dev/logging-api/context.html | Context Docs}
|
|
975
|
-
*/
|
|
976
|
-
getContext(options?: {
|
|
977
|
-
raw?: boolean;
|
|
978
|
-
}): LogLayerContext;
|
|
979
|
-
/**
|
|
980
|
-
* Creates a new instance of LogLayer but with the initialization
|
|
981
|
-
* configuration and context data copied over.
|
|
982
|
-
*
|
|
983
|
-
* The copied context data is a *shallow copy*.
|
|
984
|
-
*
|
|
985
|
-
* @see {@link https://loglayer.dev/logging-api/child-loggers.html | Child Logging Docs}
|
|
986
|
-
*/
|
|
987
|
-
child(): This;
|
|
988
|
-
/**
|
|
989
|
-
* Disables inclusion of context data in the print
|
|
990
|
-
*
|
|
991
|
-
* @see {@link https://loglayer.dev/logging-api/context.html#managing-context | Managing Context Docs}
|
|
992
|
-
*/
|
|
993
|
-
muteContext(): This;
|
|
994
|
-
/**
|
|
995
|
-
* Enables inclusion of context data in the print
|
|
996
|
-
*
|
|
997
|
-
* @see {@link https://loglayer.dev/logging-api/context.html#managing-context | Managing Context Docs}
|
|
998
|
-
*/
|
|
999
|
-
unMuteContext(): This;
|
|
1000
|
-
/**
|
|
1001
|
-
* Disables inclusion of metadata data in the print
|
|
1002
|
-
*
|
|
1003
|
-
* @see {@link https://loglayer.dev/logging-api/metadata.html#controlling-metadata-output | Controlling Metadata Output Docs}
|
|
1004
|
-
*/
|
|
1005
|
-
muteMetadata(): This;
|
|
1006
|
-
/**
|
|
1007
|
-
* Enables inclusion of metadata data in the print
|
|
1008
|
-
*
|
|
1009
|
-
* @see {@link https://loglayer.dev/logging-api/metadata.html#controlling-metadata-output | Controlling Metadata Output Docs}
|
|
1010
|
-
*/
|
|
1011
|
-
unMuteMetadata(): This;
|
|
1012
|
-
/**
|
|
1013
|
-
* Enables a specific log level
|
|
1014
|
-
*
|
|
1015
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
1016
|
-
*/
|
|
1017
|
-
enableIndividualLevel(logLevel: LogLevelType): This;
|
|
1018
|
-
/**
|
|
1019
|
-
* Disables a specific log level
|
|
1020
|
-
*
|
|
1021
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
1022
|
-
*/
|
|
1023
|
-
disableIndividualLevel(logLevel: LogLevelType): This;
|
|
1024
|
-
/**
|
|
1025
|
-
* Sets the minimum log level to be used by the logger. Only messages with
|
|
1026
|
-
* this level or higher severity will be logged.
|
|
1027
|
-
*
|
|
1028
|
-
* For example, if you setLevel(LogLevel.warn), this will:
|
|
1029
|
-
* Enable:
|
|
1030
|
-
* - warn
|
|
1031
|
-
* - error
|
|
1032
|
-
* - fatal
|
|
1033
|
-
* Disable:
|
|
1034
|
-
* - info
|
|
1035
|
-
* - debug
|
|
1036
|
-
* - trace
|
|
1037
|
-
*
|
|
1038
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
1039
|
-
*/
|
|
1040
|
-
setLevel(logLevel: LogLevelType): This;
|
|
1041
|
-
/**
|
|
1042
|
-
* Checks if a specific log level is enabled
|
|
1043
|
-
*
|
|
1044
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#checking-if-a-log-level-is-enabled | Checking if a Log Level is Enabled Docs}
|
|
1045
|
-
*/
|
|
1046
|
-
isLevelEnabled(logLevel: LogLevelType): boolean;
|
|
1047
|
-
/**
|
|
1048
|
-
* Enable sending logs to the logging library.
|
|
1049
|
-
*
|
|
1050
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
1051
|
-
*/
|
|
1052
|
-
enableLogging(): This;
|
|
1053
|
-
/**
|
|
1054
|
-
* All logging inputs are dropped and stops sending logs to the logging library.
|
|
1055
|
-
*
|
|
1056
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
1057
|
-
*/
|
|
1058
|
-
disableLogging(): This;
|
|
1059
|
-
/**
|
|
1060
|
-
* Returns a logger instance for a specific transport
|
|
1061
|
-
*
|
|
1062
|
-
* @see {@link https://loglayer.dev/logging-api/transport-management.html | Transport Management Docs}
|
|
1063
|
-
*/
|
|
1064
|
-
getLoggerInstance<Library>(id: string): Library | undefined;
|
|
1065
|
-
/**
|
|
1066
|
-
* Replaces all existing transports with new ones while preserving other logger configuration.
|
|
1067
|
-
*
|
|
1068
|
-
* Transport changes only affect the current logger instance. Child loggers
|
|
1069
|
-
* created before the change will retain their original transports, and
|
|
1070
|
-
* parent loggers are not affected when a child modifies its transports.
|
|
1071
|
-
*
|
|
1072
|
-
* @see {@link https://loglayer.dev/logging-api/transport-management.html | Transport Management Docs}
|
|
1073
|
-
*/
|
|
1074
|
-
withFreshTransports(transports: LogLayerTransport | Array<LogLayerTransport>): This;
|
|
1075
|
-
/**
|
|
1076
|
-
* Adds one or more transports to the existing transports.
|
|
1077
|
-
* If a transport with the same ID already exists, it will be replaced.
|
|
1078
|
-
*
|
|
1079
|
-
* Transport changes only affect the current logger instance. Child loggers
|
|
1080
|
-
* created before the change will retain their original transports, and
|
|
1081
|
-
* parent loggers are not affected when a child modifies its transports.
|
|
1082
|
-
*
|
|
1083
|
-
* @see {@link https://loglayer.dev/logging-api/transport-management.html | Transport Management Docs}
|
|
1084
|
-
*/
|
|
1085
|
-
addTransport(transports: LogLayerTransport | Array<LogLayerTransport>): This;
|
|
1086
|
-
/**
|
|
1087
|
-
* Removes a transport by its ID.
|
|
1088
|
-
*
|
|
1089
|
-
* Transport changes only affect the current logger instance. Child loggers
|
|
1090
|
-
* created before the change will retain their original transports, and
|
|
1091
|
-
* parent loggers are not affected when a child modifies its transports.
|
|
1092
|
-
*
|
|
1093
|
-
* @returns true if the transport was found and removed, false otherwise.
|
|
1094
|
-
*
|
|
1095
|
-
* @see {@link https://loglayer.dev/logging-api/transport-management.html | Transport Management Docs}
|
|
1096
|
-
*/
|
|
1097
|
-
removeTransport(id: string): boolean;
|
|
1098
|
-
/**
|
|
1099
|
-
* Replaces all existing plugins with new ones.
|
|
1100
|
-
*
|
|
1101
|
-
* When used with child loggers, it only affects the current logger instance
|
|
1102
|
-
* and does not modify the parent's plugins.
|
|
1103
|
-
*
|
|
1104
|
-
* @see {@link https://loglayer.dev/plugins/ | Plugins Docs}
|
|
1105
|
-
*/
|
|
1106
|
-
withFreshPlugins(plugins: Array<LogLayerPlugin>): This;
|
|
1107
|
-
/**
|
|
1108
|
-
* Sets the context manager to use for managing context data.
|
|
1109
|
-
*/
|
|
1110
|
-
withContextManager(manager: IContextManager): This;
|
|
1111
|
-
/**
|
|
1112
|
-
* Gets the context manager used by the logger.
|
|
1113
|
-
*/
|
|
1114
|
-
getContextManager<M extends IContextManager = IContextManager>(): M;
|
|
1115
|
-
/**
|
|
1116
|
-
* Sets the log level manager to use for managing log levels.
|
|
1117
|
-
*/
|
|
1118
|
-
withLogLevelManager(manager: ILogLevelManager): This;
|
|
1119
|
-
/**
|
|
1120
|
-
* Gets the log level manager used by the logger.
|
|
1121
|
-
*/
|
|
1122
|
-
getLogLevelManager<M extends ILogLevelManager = ILogLevelManager>(): M;
|
|
1123
|
-
/**
|
|
1124
|
-
* Returns the configuration object used to initialize the logger.
|
|
1125
|
-
*/
|
|
1126
|
-
getConfig(): {
|
|
1127
|
-
prefix?: string;
|
|
1128
|
-
enabled?: boolean;
|
|
1129
|
-
consoleDebug?: boolean;
|
|
1130
|
-
transport: LogLayerTransport | Array<LogLayerTransport>;
|
|
1131
|
-
plugins?: Array<LogLayerPlugin>;
|
|
1132
|
-
errorSerializer?: (err: any) => Record<string, any> | string;
|
|
1133
|
-
errorFieldName?: string;
|
|
1134
|
-
copyMsgOnOnlyError?: boolean;
|
|
1135
|
-
errorFieldInMetadata?: boolean;
|
|
1136
|
-
contextFieldName?: string;
|
|
1137
|
-
metadataFieldName?: string;
|
|
1138
|
-
muteContext?: boolean;
|
|
1139
|
-
muteMetadata?: boolean;
|
|
1140
|
-
groups?: LogGroupsConfig;
|
|
1141
|
-
activeGroups?: string[] | null;
|
|
1142
|
-
ungroupedBehavior?: "all" | "none" | string[];
|
|
1143
|
-
};
|
|
1144
|
-
/**
|
|
1145
|
-
* Logs a raw log entry with complete control over all log parameters.
|
|
1146
|
-
*
|
|
1147
|
-
* This method allows you to bypass the normal LogLayer API and directly specify
|
|
1148
|
-
* all aspects of a log entry including log level, messages, metadata, and error.
|
|
1149
|
-
* It's useful for scenarios where you need to log structured data that doesn't
|
|
1150
|
-
* fit the standard LogLayer patterns, or when integrating with external logging
|
|
1151
|
-
* systems that provide pre-formatted log entries.
|
|
1152
|
-
*
|
|
1153
|
-
* The raw entry will still go through all LogLayer processing.
|
|
1154
|
-
* Returns a Promise when async lazy values are present in the entry's metadata.
|
|
1155
|
-
*
|
|
1156
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html | Basic Logging Docs}
|
|
1157
|
-
*/
|
|
1158
|
-
raw<R extends RawLogEntry>(rawEntry: R): LogReturnType<ContainsAsyncLazy<NonNullable<R["metadata"]>>>;
|
|
1159
|
-
} //#endregion
|
|
1160
|
-
//#region src/template-utils.d.ts
|
|
1161
|
-
/**
|
|
1162
|
-
* Arguments from a tagged template literal call: [TemplateStringsArray, ...values]
|
|
1163
|
-
*/
|
|
1164
|
-
type TaggedTemplateArgs = [TemplateStringsArray, ...any[]];
|
|
1165
|
-
/**
|
|
1166
|
-
* Union of tagged template args and regular message args.
|
|
1167
|
-
* Used by log methods that accept both syntaxes:
|
|
1168
|
-
* - log.info\`Message ${value}\`
|
|
1169
|
-
* - log.info("Message", value)
|
|
1170
|
-
*/
|
|
1171
|
-
type TaggedTemplateOrMessageArgs = TaggedTemplateArgs | MessageDataType[];
|
|
1172
|
-
/**
|
|
1173
|
-
* Converts tagged template arguments to a message array.
|
|
1174
|
-
* Detects tagged templates by checking for the `raw` property on TemplateStringsArray.
|
|
1175
|
-
*/
|
|
1176
|
-
//#endregion
|
|
1177
|
-
//#region ../../core/plugin/dist/index.d.ts
|
|
1178
|
-
/**
|
|
1179
|
-
* List of plugin callbacks that can be called by the plugin manager.
|
|
1180
|
-
*
|
|
1181
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#transformloglevel | transformLogLevel Docs}
|
|
1182
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforedataout | onBeforeDataOut Docs}
|
|
1183
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#shouldsendtologger | shouldSendToLogger Docs}
|
|
1184
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onmetadatacalled | onMetadataCalled Docs}
|
|
1185
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforemessageout | onBeforeMessageOut Docs}
|
|
1186
|
-
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#oncontextcalled | onContextCalled Docs}
|
|
1187
|
-
*/
|
|
1188
|
-
declare enum PluginCallbackType {
|
|
1189
|
-
transformLogLevel = "transformLogLevel",
|
|
1190
|
-
onBeforeDataOut = "onBeforeDataOut",
|
|
1191
|
-
shouldSendToLogger = "shouldSendToLogger",
|
|
1192
|
-
onMetadataCalled = "onMetadataCalled",
|
|
1193
|
-
onBeforeMessageOut = "onBeforeMessageOut",
|
|
1194
|
-
onContextCalled = "onContextCalled"
|
|
1195
|
-
} //#endregion
|
|
1196
|
-
//#endregion
|
|
1197
|
-
//#region ../../core/loglayer/dist/index.d.ts
|
|
1198
|
-
//#region src/PluginManager.d.ts
|
|
1199
|
-
/**
|
|
1200
|
-
* A class that manages plugins and runs their callbacks.
|
|
1201
|
-
* Used by LogLayer to run plugins at various stages of the logging process.
|
|
1202
|
-
*/
|
|
1203
|
-
declare class PluginManager {
|
|
1204
|
-
private idToPlugin;
|
|
1205
|
-
private transformLogLevel;
|
|
1206
|
-
private onBeforeDataOut;
|
|
1207
|
-
private shouldSendToLogger;
|
|
1208
|
-
private onMetadataCalled;
|
|
1209
|
-
private onBeforeMessageOut;
|
|
1210
|
-
private onContextCalled;
|
|
1211
|
-
constructor(plugins: Array<LogLayerPlugin>);
|
|
1212
|
-
private mapPlugins;
|
|
1213
|
-
private indexPlugins;
|
|
1214
|
-
hasPlugins(callbackType: PluginCallbackType): boolean;
|
|
1215
|
-
countPlugins(callbackType?: PluginCallbackType): number;
|
|
1216
|
-
addPlugins(plugins: Array<LogLayerPlugin>): void;
|
|
1217
|
-
enablePlugin(id: string): void;
|
|
1218
|
-
disablePlugin(id: string): void;
|
|
1219
|
-
removePlugin(id: string): void;
|
|
1220
|
-
/**
|
|
1221
|
-
* Runs plugins that define transformLogLevel. Returns the transformed log level or the original if no transformation is applied.
|
|
1222
|
-
* If multiple plugins transform the log level, the last one wins.
|
|
1223
|
-
*/
|
|
1224
|
-
runTransformLogLevel(params: PluginTransformLogLevelParams, loglayer: ILogLayer): LogLevelType;
|
|
1225
|
-
/**
|
|
1226
|
-
* Runs plugins that defines onBeforeDataOut.
|
|
1227
|
-
*/
|
|
1228
|
-
runOnBeforeDataOut(params: PluginBeforeDataOutParams, loglayer: ILogLayer): LogLayerData | undefined;
|
|
1229
|
-
/**
|
|
1230
|
-
* Runs plugins that define shouldSendToLogger. Any plugin that returns false will prevent the message from being sent to the transport.
|
|
1231
|
-
*/
|
|
1232
|
-
runShouldSendToLogger(params: PluginShouldSendToLoggerParams, loglayer: ILogLayer): boolean;
|
|
1233
|
-
/**
|
|
1234
|
-
* Runs plugins that define onMetadataCalled.
|
|
1235
|
-
*/
|
|
1236
|
-
runOnMetadataCalled(metadata: LogLayerMetadata, loglayer: ILogLayer): LogLayerMetadata | null;
|
|
1237
|
-
runOnBeforeMessageOut(params: PluginBeforeMessageOutParams, loglayer: ILogLayer): MessageDataType[];
|
|
1238
|
-
/**
|
|
1239
|
-
* Runs plugins that define onContextCalled.
|
|
1240
|
-
*/
|
|
1241
|
-
runOnContextCalled(context: Record<string, any>, loglayer: ILogLayer): Record<string, any> | null;
|
|
1242
|
-
} //#endregion
|
|
1243
|
-
//#region src/MockLogBuilder.d.ts
|
|
1244
|
-
/**
|
|
1245
|
-
* A mock implementation of the ILogBuilder interface that does nothing.
|
|
1246
|
-
* Useful for writing unit tests.
|
|
1247
|
-
*/
|
|
1248
|
-
declare class MockLogBuilder implements ILogBuilder<MockLogBuilder, false> {
|
|
1249
|
-
debug(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1250
|
-
error(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1251
|
-
info(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1252
|
-
trace(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1253
|
-
warn(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1254
|
-
fatal(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1255
|
-
enableLogging(): this;
|
|
1256
|
-
disableLogging(): this;
|
|
1257
|
-
withMetadata(_metadata?: Record<string, any>): any;
|
|
1258
|
-
withError(_error: any): any;
|
|
1259
|
-
withGroup(_group: string | string[]): any;
|
|
1260
|
-
} //#endregion
|
|
1261
|
-
//#region src/MockLogLayer.d.ts
|
|
1262
|
-
/**
|
|
1263
|
-
* A mock implementation of the ILogLayer interface that does nothing.
|
|
1264
|
-
* Useful for writing unit tests.
|
|
1265
|
-
* MockLogLayer implements both ILogLayer and ILogBuilder for simplicity in testing.
|
|
1266
|
-
*/
|
|
1267
|
-
declare class MockLogLayer$1 implements ILogLayer<MockLogLayer$1> {
|
|
1268
|
-
private mockLogBuilder;
|
|
1269
|
-
private mockContextManager;
|
|
1270
|
-
private mockLogLevelManager;
|
|
1271
|
-
info(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1272
|
-
warn(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1273
|
-
error(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1274
|
-
debug(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1275
|
-
trace(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1276
|
-
fatal(..._args: TaggedTemplateOrMessageArgs): void;
|
|
1277
|
-
raw(_rawEntry: RawLogEntry): any;
|
|
1278
|
-
getLoggerInstance<_T extends LogLayerTransport>(_id: string): any;
|
|
1279
|
-
errorOnly(_error: any, _opts?: ErrorOnlyOpts): void;
|
|
1280
|
-
metadataOnly(_metadata?: Record<string, any>, _logLevel?: LogLevel): any;
|
|
1281
|
-
addPlugins(_plugins: Array<LogLayerPlugin>): void;
|
|
1282
|
-
removePlugin(_id: string): void;
|
|
1283
|
-
enablePlugin(_id: string): void;
|
|
1284
|
-
disablePlugin(_id: string): void;
|
|
1285
|
-
withPrefix(_prefix: string): this;
|
|
1286
|
-
withGroup(_group: string | string[]): this;
|
|
1287
|
-
addGroup(_name: string, _config: LogGroupConfig): this;
|
|
1288
|
-
removeGroup(_name: string): this;
|
|
1289
|
-
enableGroup(_name: string): this;
|
|
1290
|
-
disableGroup(_name: string): this;
|
|
1291
|
-
setGroupLevel(_name: string, _level: LogLevelType): this;
|
|
1292
|
-
setActiveGroups(_groups: string[] | null): this;
|
|
1293
|
-
getGroups(): LogGroupsConfig;
|
|
1294
|
-
withContext(_context?: Record<string, any>): this;
|
|
1295
|
-
withError(_error: any): ILogBuilder<any, false>;
|
|
1296
|
-
withMetadata<M extends LogLayerMetadata>(_metadata?: M): ILogBuilder<any, ContainsAsyncLazy<NonNullable<M>>>;
|
|
1297
|
-
getContext(_options?: {
|
|
1298
|
-
raw?: boolean;
|
|
1299
|
-
}): Record<string, any>;
|
|
1300
|
-
clearContext(_keys?: string | string[]): this;
|
|
1301
|
-
enableLogging(): this;
|
|
1302
|
-
disableLogging(): this;
|
|
1303
|
-
child(): this;
|
|
1304
|
-
muteContext(): this;
|
|
1305
|
-
unMuteContext(): this;
|
|
1306
|
-
muteMetadata(): this;
|
|
1307
|
-
unMuteMetadata(): this;
|
|
1308
|
-
withFreshTransports(_transports: LogLayerTransport | Array<LogLayerTransport>): this;
|
|
1309
|
-
addTransport(_transports: LogLayerTransport | Array<LogLayerTransport>): this;
|
|
1310
|
-
removeTransport(_id: string): boolean;
|
|
1311
|
-
withFreshPlugins(_plugins: Array<LogLayerPlugin>): this;
|
|
1312
|
-
withContextManager(_contextManager: any): this;
|
|
1313
|
-
getContextManager<M extends IContextManager = IContextManager>(): M;
|
|
1314
|
-
withLogLevelManager(_logLevelManager: ILogLevelManager): this;
|
|
1315
|
-
getLogLevelManager<M extends ILogLevelManager = ILogLevelManager>(): M;
|
|
1316
|
-
getConfig(): any;
|
|
1317
|
-
/**
|
|
1318
|
-
* Sets the mock log builder to use for testing.
|
|
1319
|
-
*/
|
|
1320
|
-
setMockLogBuilder(mockLogBuilder: ILogBuilder): void;
|
|
1321
|
-
enableIndividualLevel(_logLevel: LogLevelType): this;
|
|
1322
|
-
disableIndividualLevel(_logLevel: LogLevelType): this;
|
|
1323
|
-
setLevel(_logLevel: LogLevelType): this;
|
|
1324
|
-
isLevelEnabled(_logLevel: LogLevelType): boolean;
|
|
1325
|
-
/**
|
|
1326
|
-
* Returns the mock log builder used for testing.
|
|
1327
|
-
*/
|
|
1328
|
-
getMockLogBuilder(): ILogBuilder<ILogBuilder<any, any>, false>;
|
|
1329
|
-
/**
|
|
1330
|
-
* Resets the mock log builder to a new instance of MockLogBuilder.
|
|
1331
|
-
*/
|
|
1332
|
-
resetMockLogBuilder(): void;
|
|
1333
|
-
} //#endregion
|
|
1334
|
-
//#region src/types/mixin.types.d.ts
|
|
1335
|
-
/**
|
|
1336
|
-
* The class that the mixin extends
|
|
1337
|
-
*/
|
|
1338
|
-
declare enum LogLayerMixinAugmentType {
|
|
1339
|
-
/**
|
|
1340
|
-
* Mixin extends the LogBuilder prototype
|
|
1341
|
-
*/
|
|
1342
|
-
LogBuilder = "LogBuilder",
|
|
1343
|
-
/**
|
|
1344
|
-
* Mixin extends the LogLayer prototype
|
|
1345
|
-
*/
|
|
1346
|
-
LogLayer = "LogLayer"
|
|
1347
|
-
}
|
|
1348
|
-
/**
|
|
1349
|
-
* Interface for mixins to add custom functionality to the LogBuilder prototype.
|
|
1350
|
-
*/
|
|
1351
|
-
interface LogBuilderMixin {
|
|
1352
|
-
/**
|
|
1353
|
-
* Specifies that this mixin augments the main LogBuilder class.
|
|
1354
|
-
* This type discrimination allows TypeScript to properly type-check mixin usage.
|
|
1355
|
-
*/
|
|
1356
|
-
augmentationType: LogLayerMixinAugmentType.LogBuilder;
|
|
1357
|
-
/**
|
|
1358
|
-
* Called at the end of the LogBuilder construct() method.
|
|
1359
|
-
* The LogBuilder instance is passed as the first parameter.
|
|
1360
|
-
*/
|
|
1361
|
-
onConstruct?: (instance: LogBuilder, logger: LogLayer$1) => void;
|
|
1362
|
-
/**
|
|
1363
|
-
* Function that performs the augmentation of the LogBuilder prototype.
|
|
1364
|
-
*
|
|
1365
|
-
* @param prototype - The LogBuilder class prototype being augmented
|
|
1366
|
-
*/
|
|
1367
|
-
augment: (prototype: typeof LogBuilder.prototype) => void;
|
|
1368
|
-
/**
|
|
1369
|
-
* Function that performs the augmentation of the MockLogBuilder prototype.
|
|
1370
|
-
* This is called to ensure the mock class has the same functionality as the real class.
|
|
1371
|
-
*
|
|
1372
|
-
* @param prototype - The MockLogBuilder class prototype being augmented
|
|
1373
|
-
*/
|
|
1374
|
-
augmentMock: (prototype: typeof MockLogBuilder.prototype) => void;
|
|
1375
|
-
}
|
|
1376
|
-
/**
|
|
1377
|
-
* Interface for mixins to add custom functionality to the LogLayer prototype.
|
|
1378
|
-
*/
|
|
1379
|
-
interface LogLayerMixin {
|
|
1380
|
-
/**
|
|
1381
|
-
* Specifies that this mixin augments the main LogLayer class.
|
|
1382
|
-
* This type discrimination allows TypeScript to properly type-check mixin usage.
|
|
1383
|
-
*/
|
|
1384
|
-
augmentationType: LogLayerMixinAugmentType.LogLayer;
|
|
1385
|
-
/**
|
|
1386
|
-
* Called at the end of the LogLayer construct() method.
|
|
1387
|
-
* The LogLayer instance is passed as the first parameter.
|
|
1388
|
-
*/
|
|
1389
|
-
onConstruct?: (instance: LogLayer$1, config: LogLayerConfig) => void;
|
|
1390
|
-
/**
|
|
1391
|
-
* Function that performs the augmentation of the LogLayer prototype.
|
|
1392
|
-
*
|
|
1393
|
-
* @param prototype - The LogLayer class prototype being augmented
|
|
1394
|
-
*/
|
|
1395
|
-
augment: (prototype: typeof LogLayer$1.prototype) => void;
|
|
1396
|
-
/**
|
|
1397
|
-
* Function that performs the augmentation of the MockLogLayer prototype.
|
|
1398
|
-
* This is called to ensure the mock class has the same functionality as the real class.
|
|
1399
|
-
*
|
|
1400
|
-
* @param prototype - The MockLogLayer class prototype being augmented
|
|
1401
|
-
*/
|
|
1402
|
-
augmentMock: (prototype: typeof MockLogLayer$1.prototype) => void;
|
|
1403
|
-
}
|
|
1404
|
-
type LogLayerMixinType = LogBuilderMixin | LogLayerMixin;
|
|
1405
|
-
/**
|
|
1406
|
-
* Interface for registering mixins to LogLayer.
|
|
1407
|
-
*/
|
|
1408
|
-
interface LogLayerMixinRegistration {
|
|
1409
|
-
/**
|
|
1410
|
-
* Array of mixins to add to LogLayer.
|
|
1411
|
-
*/
|
|
1412
|
-
mixinsToAdd: LogLayerMixinType[];
|
|
1413
|
-
/**
|
|
1414
|
-
* Array of plugins to add to LogLayer.
|
|
1415
|
-
*/
|
|
1416
|
-
pluginsToAdd?: LogLayerPlugin[];
|
|
1417
|
-
} //#endregion
|
|
1418
|
-
//#region src/types/index.d.ts
|
|
1419
|
-
type ErrorSerializerType = (err: any) => Record<string, any> | string;
|
|
1420
|
-
/**
|
|
1421
|
-
* Configuration options for LogLayer
|
|
1422
|
-
* @see {@link https://loglayer.dev/configuration.html | LogLayer Configuration Docs}
|
|
1423
|
-
*/
|
|
1424
|
-
interface LogLayerConfig {
|
|
1425
|
-
/**
|
|
1426
|
-
* The prefix to prepend to all log messages
|
|
1427
|
-
*/
|
|
1428
|
-
prefix?: string;
|
|
1429
|
-
/**
|
|
1430
|
-
* Set false to drop all log input and stop sending to the logging
|
|
1431
|
-
* library.
|
|
1432
|
-
*
|
|
1433
|
-
* Can be re-enabled with `enableLogging()`.
|
|
1434
|
-
*
|
|
1435
|
-
* Default is `true`.
|
|
1436
|
-
*/
|
|
1437
|
-
enabled?: boolean;
|
|
1438
|
-
/**
|
|
1439
|
-
* If set to true, will also output messages via console logging before
|
|
1440
|
-
* sending to the logging library.
|
|
1441
|
-
*
|
|
1442
|
-
* Useful for troubleshooting a logging library / transports
|
|
1443
|
-
* to ensure logs are still being created when the underlying
|
|
1444
|
-
* does not print anything.
|
|
1445
|
-
*/
|
|
1446
|
-
consoleDebug?: boolean;
|
|
1447
|
-
/**
|
|
1448
|
-
* The transport(s) that implements a logging library to send logs to.
|
|
1449
|
-
* Can be a single transport or an array of transports.
|
|
1450
|
-
*/
|
|
1451
|
-
transport: LogLayerTransport | Array<LogLayerTransport>;
|
|
1452
|
-
/**
|
|
1453
|
-
* Plugins to use.
|
|
1454
|
-
*/
|
|
1455
|
-
plugins?: Array<LogLayerPlugin>;
|
|
1456
|
-
/**
|
|
1457
|
-
* A function that takes in an incoming Error type and transforms it into an object.
|
|
1458
|
-
* Used in the event that the logging library does not natively support serialization of errors.
|
|
1459
|
-
*/
|
|
1460
|
-
errorSerializer?: ErrorSerializerType;
|
|
1461
|
-
/**
|
|
1462
|
-
* Logging libraries may require a specific field name for errors so it knows
|
|
1463
|
-
* how to parse them.
|
|
1464
|
-
*
|
|
1465
|
-
* Default is 'err'.
|
|
1466
|
-
*/
|
|
1467
|
-
errorFieldName?: string;
|
|
1468
|
-
/**
|
|
1469
|
-
* If true, always copy error.message if available as a log message along
|
|
1470
|
-
* with providing the error data to the logging library.
|
|
1471
|
-
*
|
|
1472
|
-
* Can be overridden individually by setting `copyMsg: false` in the `onlyError()`
|
|
1473
|
-
* call.
|
|
1474
|
-
*
|
|
1475
|
-
* Default is false.
|
|
1476
|
-
*/
|
|
1477
|
-
copyMsgOnOnlyError?: boolean;
|
|
1478
|
-
/**
|
|
1479
|
-
* If set to true, the error will be included as part of metadata instead
|
|
1480
|
-
* of the root of the log data.
|
|
1481
|
-
*
|
|
1482
|
-
* metadataFieldName must be set to true for this to work.
|
|
1483
|
-
*
|
|
1484
|
-
* Default is false.
|
|
1485
|
-
*/
|
|
1486
|
-
errorFieldInMetadata?: boolean;
|
|
1487
|
-
/**
|
|
1488
|
-
* If specified, will set the context object to a specific field
|
|
1489
|
-
* instead of flattening the data alongside the error and message.
|
|
1490
|
-
*
|
|
1491
|
-
* Default is context data will be flattened.
|
|
1492
|
-
*/
|
|
1493
|
-
contextFieldName?: string;
|
|
1494
|
-
/**
|
|
1495
|
-
* If specified, will set the metadata object to a specific field
|
|
1496
|
-
* instead of flattening the data alongside the error and message.
|
|
1497
|
-
*
|
|
1498
|
-
* Default is metadata will be flattened.
|
|
1499
|
-
*/
|
|
1500
|
-
metadataFieldName?: string;
|
|
1501
|
-
/**
|
|
1502
|
-
* If set to true, will not include context data in the log message.
|
|
1503
|
-
*/
|
|
1504
|
-
muteContext?: boolean;
|
|
1505
|
-
/**
|
|
1506
|
-
* If set to true, will not include metadata data in the log message.
|
|
1507
|
-
*/
|
|
1508
|
-
muteMetadata?: boolean;
|
|
1509
|
-
/**
|
|
1510
|
-
* Named routing groups. Each group defines which transports it routes to
|
|
1511
|
-
* and an optional minimum log level.
|
|
1512
|
-
*
|
|
1513
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1514
|
-
*/
|
|
1515
|
-
groups?: LogGroupsConfig;
|
|
1516
|
-
/**
|
|
1517
|
-
* When set, only these group names are active. Logs tagged with inactive
|
|
1518
|
-
* groups are dropped. The `LOGLAYER_GROUPS` env variable overrides this
|
|
1519
|
-
* at construction time.
|
|
1520
|
-
*
|
|
1521
|
-
* Set to `null` to clear the filter (all defined groups are active).
|
|
1522
|
-
*
|
|
1523
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1524
|
-
*/
|
|
1525
|
-
activeGroups?: string[] | null;
|
|
1526
|
-
/**
|
|
1527
|
-
* Controls what happens to logs that have NO group tags.
|
|
1528
|
-
* - `'all'` (default): ungrouped logs go to ALL transports (backward compatible).
|
|
1529
|
-
* - `'none'`: ungrouped logs are dropped entirely.
|
|
1530
|
-
* - `string[]`: ungrouped logs go only to the listed transport IDs.
|
|
1531
|
-
*
|
|
1532
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1533
|
-
*/
|
|
1534
|
-
ungroupedBehavior?: "all" | "none" | string[];
|
|
1535
|
-
} //#endregion
|
|
1536
|
-
//#region src/LogLayer.d.ts
|
|
1537
|
-
interface FormatLogParams {
|
|
1538
|
-
logLevel: LogLevelType;
|
|
1539
|
-
params?: any[];
|
|
1540
|
-
metadata?: LogLayerMetadata | null;
|
|
1541
|
-
rootData?: LogLayerMetadata | null;
|
|
1542
|
-
err?: any;
|
|
1543
|
-
context?: LogLayerContext | null;
|
|
1544
|
-
groups?: string[] | null;
|
|
1545
|
-
}
|
|
1546
|
-
/**
|
|
1547
|
-
* Wraps around a logging framework to provide convenience methods that allow
|
|
1548
|
-
* developers to programmatically specify their errors and metadata along with
|
|
1549
|
-
* a message in a consistent fashion.
|
|
1550
|
-
*/
|
|
1551
|
-
declare class LogLayer$1 implements ILogLayer<LogLayer$1> {
|
|
1552
|
-
private pluginManager;
|
|
1553
|
-
private idToTransport;
|
|
1554
|
-
private hasMultipleTransports;
|
|
1555
|
-
private singleTransport;
|
|
1556
|
-
private contextManager;
|
|
1557
|
-
private logLevelManager;
|
|
1558
|
-
private _isLoggingLazyError;
|
|
1559
|
-
private _lazyContextCount;
|
|
1560
|
-
private _assignedGroups;
|
|
1561
|
-
private _groupsConfig;
|
|
1562
|
-
private _activeGroups;
|
|
1563
|
-
private _ungroupedBehavior;
|
|
1564
|
-
/**
|
|
1565
|
-
* The configuration object used to initialize the logger.
|
|
1566
|
-
* This is for internal use only and should not be modified directly.
|
|
1567
|
-
*/
|
|
1568
|
-
_config: LogLayerConfig;
|
|
1569
|
-
constructor(config: LogLayerConfig);
|
|
1570
|
-
/**
|
|
1571
|
-
* Sets the context manager to use for managing context data.
|
|
1572
|
-
*/
|
|
1573
|
-
withContextManager(contextManager: IContextManager): LogLayer$1;
|
|
1574
|
-
/**
|
|
1575
|
-
* Returns the context manager instance being used.
|
|
1576
|
-
*/
|
|
1577
|
-
getContextManager<M extends IContextManager = IContextManager>(): M;
|
|
1578
|
-
/**
|
|
1579
|
-
* Sets the log level manager to use for managing log levels.
|
|
1580
|
-
*/
|
|
1581
|
-
withLogLevelManager(logLevelManager: ILogLevelManager): LogLayer$1;
|
|
1582
|
-
/**
|
|
1583
|
-
* Returns the log level manager instance being used.
|
|
1584
|
-
*/
|
|
1585
|
-
getLogLevelManager<M extends ILogLevelManager = ILogLevelManager>(): M;
|
|
1586
|
-
/**
|
|
1587
|
-
* Returns the configuration object used to initialize the logger.
|
|
1588
|
-
*/
|
|
1589
|
-
getConfig(): LogLayerConfig;
|
|
1590
|
-
private _initializeTransports;
|
|
1591
|
-
/**
|
|
1592
|
-
* Calls child() and sets the prefix to be included with every log message.
|
|
1593
|
-
*
|
|
1594
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#message-prefixing | Message Prefixing Docs}
|
|
1595
|
-
*/
|
|
1596
|
-
withPrefix(prefix: string): LogLayer$1;
|
|
1597
|
-
/**
|
|
1598
|
-
* Creates a child logger with the specified group(s) persistently assigned.
|
|
1599
|
-
* All logs from the child will be tagged with these groups.
|
|
1600
|
-
*
|
|
1601
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1602
|
-
*/
|
|
1603
|
-
withGroup(group: string | string[]): LogLayer$1;
|
|
1604
|
-
/**
|
|
1605
|
-
* Adds a new group definition at runtime.
|
|
1606
|
-
*
|
|
1607
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1608
|
-
*/
|
|
1609
|
-
addGroup(name: string, config: LogGroupConfig): LogLayer$1;
|
|
1610
|
-
/**
|
|
1611
|
-
* Removes a group definition at runtime.
|
|
1612
|
-
*
|
|
1613
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1614
|
-
*/
|
|
1615
|
-
removeGroup(name: string): LogLayer$1;
|
|
1616
|
-
/**
|
|
1617
|
-
* Enables a group by name (sets enabled: true).
|
|
1618
|
-
*
|
|
1619
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1620
|
-
*/
|
|
1621
|
-
enableGroup(name: string): LogLayer$1;
|
|
1622
|
-
/**
|
|
1623
|
-
* Disables a group by name (sets enabled: false).
|
|
1624
|
-
*
|
|
1625
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1626
|
-
*/
|
|
1627
|
-
disableGroup(name: string): LogLayer$1;
|
|
1628
|
-
/**
|
|
1629
|
-
* Sets the minimum log level for a group at runtime.
|
|
1630
|
-
*
|
|
1631
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1632
|
-
*/
|
|
1633
|
-
setGroupLevel(name: string, level: LogLevelType): LogLayer$1;
|
|
1634
|
-
/**
|
|
1635
|
-
* Sets which groups are active. Only active groups will route logs.
|
|
1636
|
-
* Pass null to clear the filter (all groups active).
|
|
1637
|
-
*
|
|
1638
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1639
|
-
*/
|
|
1640
|
-
setActiveGroups(groups: string[] | null): LogLayer$1;
|
|
1641
|
-
/**
|
|
1642
|
-
* Returns a snapshot of all group configurations.
|
|
1643
|
-
*
|
|
1644
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
1645
|
-
*/
|
|
1646
|
-
getGroups(): LogGroupsConfig;
|
|
1647
|
-
/**
|
|
1648
|
-
* Appends context data which will be included with
|
|
1649
|
-
* every log entry.
|
|
1650
|
-
*
|
|
1651
|
-
* Passing in an empty value / object will *not* clear the context.
|
|
1652
|
-
*
|
|
1653
|
-
* To clear the context, use {@link https://loglayer.dev/logging-api/context.html#clearing-context | clearContext()}.
|
|
1654
|
-
*
|
|
1655
|
-
* @see {@link https://loglayer.dev/logging-api/context.html | Context Docs}
|
|
1656
|
-
*/
|
|
1657
|
-
withContext(context?: LogLayerContext): LogLayer$1;
|
|
1658
|
-
/**
|
|
1659
|
-
* Clears the context data. If keys are provided, only those keys will be removed.
|
|
1660
|
-
* If no keys are provided, all context data will be cleared.
|
|
1661
|
-
*/
|
|
1662
|
-
clearContext(keys?: string | string[]): this;
|
|
1663
|
-
getContext(options?: {
|
|
1664
|
-
raw?: boolean;
|
|
1665
|
-
}): LogLayerContext;
|
|
1666
|
-
/**
|
|
1667
|
-
* Add additional plugins.
|
|
1668
|
-
*
|
|
1669
|
-
* @see {@link https://loglayer.dev/plugins/ | Plugins Docs}
|
|
1670
|
-
*/
|
|
1671
|
-
addPlugins(plugins: Array<LogLayerPlugin>): void;
|
|
1672
|
-
/**
|
|
1673
|
-
* Enables a plugin by id.
|
|
1674
|
-
*
|
|
1675
|
-
* @see {@link https://loglayer.dev/plugins/ | Plugins Docs}
|
|
1676
|
-
*/
|
|
1677
|
-
enablePlugin(id: string): void;
|
|
1678
|
-
/**
|
|
1679
|
-
* Disables a plugin by id.
|
|
1680
|
-
*
|
|
1681
|
-
* @see {@link https://loglayer.dev/plugins/ | Plugins Docs}
|
|
1682
|
-
*/
|
|
1683
|
-
disablePlugin(id: string): void;
|
|
1684
|
-
/**
|
|
1685
|
-
* Removes a plugin by id.
|
|
1686
|
-
*
|
|
1687
|
-
* @see {@link https://loglayer.dev/plugins/ | Plugins Docs}
|
|
1688
|
-
*/
|
|
1689
|
-
removePlugin(id: string): void;
|
|
1690
|
-
/**
|
|
1691
|
-
* Specifies metadata to include with the log message
|
|
1692
|
-
*
|
|
1693
|
-
* @see {@link https://loglayer.dev/logging-api/metadata.html | Metadata Docs}
|
|
1694
|
-
*/
|
|
1695
|
-
withMetadata<M extends LogLayerMetadata>(metadata?: M): ILogBuilder<any, ContainsAsyncLazy<NonNullable<M>>>;
|
|
1696
|
-
/**
|
|
1697
|
-
* Specifies an Error to include with the log message
|
|
1698
|
-
*
|
|
1699
|
-
* @see {@link https://loglayer.dev/logging-api/error-handling.html | Error Handling Docs}
|
|
1700
|
-
*/
|
|
1701
|
-
withError(error: any): ILogBuilder<any, false>;
|
|
1702
|
-
/**
|
|
1703
|
-
* Creates a new instance of LogLayer but with the initialization
|
|
1704
|
-
* configuration and context copied over.
|
|
1705
|
-
*
|
|
1706
|
-
* @see {@link https://loglayer.dev/logging-api/child-loggers.html | Child Logging Docs}
|
|
1707
|
-
*/
|
|
1708
|
-
child(): LogLayer$1;
|
|
1709
|
-
/**
|
|
1710
|
-
* Replaces all existing transports with new ones.
|
|
1711
|
-
*
|
|
1712
|
-
* Transport changes only affect the current logger instance. Child loggers
|
|
1713
|
-
* created before the change will retain their original transports, and
|
|
1714
|
-
* parent loggers are not affected when a child modifies its transports.
|
|
1715
|
-
*
|
|
1716
|
-
* @see {@link https://loglayer.dev/logging-api/transport-management.html | Transport Management Docs}
|
|
1717
|
-
*/
|
|
1718
|
-
withFreshTransports(transports: LogLayerTransport | Array<LogLayerTransport>): LogLayer$1;
|
|
1719
|
-
/**
|
|
1720
|
-
* Adds one or more transports to the existing transports.
|
|
1721
|
-
* If a transport with the same ID already exists, it will be replaced.
|
|
1722
|
-
*
|
|
1723
|
-
* Transport changes only affect the current logger instance. Child loggers
|
|
1724
|
-
* created before the change will retain their original transports, and
|
|
1725
|
-
* parent loggers are not affected when a child modifies its transports.
|
|
1726
|
-
*
|
|
1727
|
-
* @see {@link https://loglayer.dev/logging-api/transport-management.html | Transport Management Docs}
|
|
1728
|
-
*/
|
|
1729
|
-
addTransport(transports: LogLayerTransport | Array<LogLayerTransport>): LogLayer$1;
|
|
1730
|
-
/**
|
|
1731
|
-
* Removes a transport by its ID.
|
|
1732
|
-
*
|
|
1733
|
-
* Transport changes only affect the current logger instance. Child loggers
|
|
1734
|
-
* created before the change will retain their original transports, and
|
|
1735
|
-
* parent loggers are not affected when a child modifies its transports.
|
|
1736
|
-
*
|
|
1737
|
-
* @returns true if the transport was found and removed, false otherwise.
|
|
1738
|
-
*
|
|
1739
|
-
* @see {@link https://loglayer.dev/logging-api/transport-management.html | Transport Management Docs}
|
|
1740
|
-
*/
|
|
1741
|
-
removeTransport(id: string): boolean;
|
|
1742
|
-
/**
|
|
1743
|
-
* Replaces all existing plugins with new ones.
|
|
1744
|
-
*
|
|
1745
|
-
* When used with child loggers, it only affects the current logger instance
|
|
1746
|
-
* and does not modify the parent's plugins.
|
|
1747
|
-
*
|
|
1748
|
-
* @see {@link https://loglayer.dev/plugins/ | Plugins Docs}
|
|
1749
|
-
*/
|
|
1750
|
-
withFreshPlugins(plugins: Array<LogLayerPlugin>): LogLayer$1;
|
|
1751
|
-
protected withPluginManager(pluginManager: PluginManager): this;
|
|
1752
|
-
/**
|
|
1753
|
-
* Logs only the error object without a log message
|
|
1754
|
-
*
|
|
1755
|
-
* @see {@link https://loglayer.dev/logging-api/error-handling.html | Error Handling Docs}
|
|
1756
|
-
*/
|
|
1757
|
-
errorOnly(error: any, opts?: ErrorOnlyOpts): void;
|
|
1758
|
-
/**
|
|
1759
|
-
* Logs only metadata without a log message
|
|
1760
|
-
*
|
|
1761
|
-
* @see {@link https://loglayer.dev/logging-api/metadata.html | Metadata Docs}
|
|
1762
|
-
*/
|
|
1763
|
-
metadataOnly<M extends LogLayerMetadata>(metadata?: M, logLevel?: LogLevelType): LogReturnType<ContainsAsyncLazy<NonNullable<M>>>;
|
|
1764
|
-
/**
|
|
1765
|
-
* Sends a log message to the logging library under an info log level.
|
|
1766
|
-
*
|
|
1767
|
-
* Supports tagged template syntax:
|
|
1768
|
-
* ```typescript
|
|
1769
|
-
* log.info`User ${userId} logged in`;
|
|
1770
|
-
* ```
|
|
1771
|
-
*
|
|
1772
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html | Basic Logging Docs}
|
|
1773
|
-
*/
|
|
1774
|
-
info(...args: TaggedTemplateOrMessageArgs): void;
|
|
1775
|
-
/**
|
|
1776
|
-
* Sends a log message to the logging library under the warn log level
|
|
1777
|
-
*
|
|
1778
|
-
* Supports tagged template syntax:
|
|
1779
|
-
* ```typescript
|
|
1780
|
-
* log.warn`Request ${requestId} timed out`;
|
|
1781
|
-
* ```
|
|
1782
|
-
*
|
|
1783
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html | Basic Logging Docs}
|
|
1784
|
-
*/
|
|
1785
|
-
warn(...args: TaggedTemplateOrMessageArgs): void;
|
|
1786
|
-
/**
|
|
1787
|
-
* Sends a log message to the logging library under the error log level
|
|
1788
|
-
*
|
|
1789
|
-
* Supports tagged template syntax:
|
|
1790
|
-
* ```typescript
|
|
1791
|
-
* log.error`Failed to process ${taskId}`;
|
|
1792
|
-
* ```
|
|
1793
|
-
*
|
|
1794
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html | Basic Logging Docs}
|
|
1795
|
-
*/
|
|
1796
|
-
error(...args: TaggedTemplateOrMessageArgs): void;
|
|
1797
|
-
/**
|
|
1798
|
-
* Sends a log message to the logging library under the debug log level
|
|
1799
|
-
*
|
|
1800
|
-
* Supports tagged template syntax:
|
|
1801
|
-
* ```typescript
|
|
1802
|
-
* log.debug`Cache hit for ${cacheKey}`;
|
|
1803
|
-
* ```
|
|
1804
|
-
*
|
|
1805
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html | Basic Logging Docs}
|
|
1806
|
-
*/
|
|
1807
|
-
debug(...args: TaggedTemplateOrMessageArgs): void;
|
|
1808
|
-
/**
|
|
1809
|
-
* Sends a log message to the logging library under the trace log level
|
|
1810
|
-
*
|
|
1811
|
-
* Supports tagged template syntax:
|
|
1812
|
-
* ```typescript
|
|
1813
|
-
* log.trace`Entering ${functionName}`;
|
|
1814
|
-
* ```
|
|
1815
|
-
*
|
|
1816
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html | Basic Logging Docs}
|
|
1817
|
-
*/
|
|
1818
|
-
trace(...args: TaggedTemplateOrMessageArgs): void;
|
|
1819
|
-
/**
|
|
1820
|
-
* Sends a log message to the logging library under the fatal log level
|
|
1821
|
-
*
|
|
1822
|
-
* Supports tagged template syntax:
|
|
1823
|
-
* ```typescript
|
|
1824
|
-
* log.fatal`System crash: ${reason}`;
|
|
1825
|
-
* ```
|
|
1826
|
-
*
|
|
1827
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html | Basic Logging Docs}
|
|
1828
|
-
*/
|
|
1829
|
-
fatal(...args: TaggedTemplateOrMessageArgs): void;
|
|
1830
|
-
/**
|
|
1831
|
-
* Logs a raw log entry with complete control over all log parameters.
|
|
1832
|
-
*
|
|
1833
|
-
* This method allows you to bypass the normal LogLayer API and directly specify
|
|
1834
|
-
* all aspects of a log entry including log level, messages, metadata, and error.
|
|
1835
|
-
* It's useful for scenarios where you need to log structured data that doesn't
|
|
1836
|
-
* fit the standard LogLayer patterns, or when integrating with external logging
|
|
1837
|
-
* systems that provide pre-formatted log entries.
|
|
1838
|
-
*
|
|
1839
|
-
* The raw entry will still go through all LogLayer processing.
|
|
1840
|
-
*
|
|
1841
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html | Basic Logging Docs}
|
|
1842
|
-
*/
|
|
1843
|
-
raw<R extends RawLogEntry>(logEntry: R): LogReturnType<ContainsAsyncLazy<NonNullable<R["metadata"]>>>;
|
|
1844
|
-
/**
|
|
1845
|
-
* All logging inputs are dropped and stops sending logs to the logging library.
|
|
1846
|
-
*
|
|
1847
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
1848
|
-
*/
|
|
1849
|
-
disableLogging(): this;
|
|
1850
|
-
/**
|
|
1851
|
-
* Enable sending logs to the logging library.
|
|
1852
|
-
*
|
|
1853
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
1854
|
-
*/
|
|
1855
|
-
enableLogging(): this;
|
|
1856
|
-
/**
|
|
1857
|
-
* Disables inclusion of context data in the print
|
|
1858
|
-
*
|
|
1859
|
-
* @see {@link https://loglayer.dev/logging-api/context.html#managing-context | Managing Context Docs}
|
|
1860
|
-
*/
|
|
1861
|
-
muteContext(): this;
|
|
1862
|
-
/**
|
|
1863
|
-
* Enables inclusion of context data in the print
|
|
1864
|
-
*
|
|
1865
|
-
* @see {@link https://loglayer.dev/logging-api/context.html#managing-context | Managing Context Docs}
|
|
1866
|
-
*/
|
|
1867
|
-
unMuteContext(): this;
|
|
1868
|
-
/**
|
|
1869
|
-
* Disables inclusion of metadata in the print
|
|
1870
|
-
*
|
|
1871
|
-
* @see {@link https://loglayer.dev/logging-api/metadata.html#controlling-metadata-output | Controlling Metadata Output Docs}
|
|
1872
|
-
*/
|
|
1873
|
-
muteMetadata(): this;
|
|
1874
|
-
/**
|
|
1875
|
-
* Enables inclusion of metadata in the print
|
|
1876
|
-
*
|
|
1877
|
-
* @see {@link https://loglayer.dev/logging-api/metadata.html#controlling-metadata-output | Controlling Metadata Output Docs}
|
|
1878
|
-
*/
|
|
1879
|
-
unMuteMetadata(): this;
|
|
1880
|
-
/**
|
|
1881
|
-
* Enables a specific log level
|
|
1882
|
-
*
|
|
1883
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
1884
|
-
*/
|
|
1885
|
-
enableIndividualLevel(logLevel: LogLevelType): this;
|
|
1886
|
-
/**
|
|
1887
|
-
* Disables a specific log level
|
|
1888
|
-
*
|
|
1889
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
1890
|
-
*/
|
|
1891
|
-
disableIndividualLevel(logLevel: LogLevelType): this;
|
|
1892
|
-
/**
|
|
1893
|
-
* Sets the minimum log level to be used by the logger. Only messages with
|
|
1894
|
-
* this level or higher severity will be logged.
|
|
1895
|
-
*
|
|
1896
|
-
* For example, if you setLevel(LogLevel.warn), this will:
|
|
1897
|
-
* Enable:
|
|
1898
|
-
* - warn
|
|
1899
|
-
* - error
|
|
1900
|
-
* - fatal
|
|
1901
|
-
* Disable:
|
|
1902
|
-
* - info
|
|
1903
|
-
* - debug
|
|
1904
|
-
* - trace
|
|
1905
|
-
*
|
|
1906
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#enabling-disabling-logging | Enabling/Disabling Logging Docs}
|
|
1907
|
-
*/
|
|
1908
|
-
setLevel(logLevel: LogLevelType): this;
|
|
1909
|
-
/**
|
|
1910
|
-
* Checks if a specific log level is enabled
|
|
1911
|
-
*
|
|
1912
|
-
* @see {@link https://loglayer.dev/logging-api/basic-logging.html#checking-if-a-log-level-is-enabled | Checking if a Log Level is Enabled Docs}
|
|
1913
|
-
*/
|
|
1914
|
-
isLevelEnabled(logLevel: LogLevelType): boolean;
|
|
1915
|
-
private formatContext;
|
|
1916
|
-
private formatMetadata;
|
|
1917
|
-
/**
|
|
1918
|
-
* Returns a logger instance for a specific transport
|
|
1919
|
-
*
|
|
1920
|
-
* @see {@link https://loglayer.dev/logging-api/transport-management.html | Transport Management Docs}
|
|
1921
|
-
*/
|
|
1922
|
-
getLoggerInstance<Logger>(id: string): Logger | undefined;
|
|
1923
|
-
/**
|
|
1924
|
-
* Parses the LOGLAYER_GROUPS environment variable and overrides
|
|
1925
|
-
* _activeGroups and group levels accordingly.
|
|
1926
|
-
* Format: "name,name" or "name:level,name:level"
|
|
1927
|
-
*/
|
|
1928
|
-
private _parseEnvGroups;
|
|
1929
|
-
/**
|
|
1930
|
-
* Merges per-log groups (from LogBuilder) with logger-level assigned groups.
|
|
1931
|
-
*/
|
|
1932
|
-
private _mergeGroups;
|
|
1933
|
-
/**
|
|
1934
|
-
* Applies ungrouped routing rules for a transport.
|
|
1935
|
-
*/
|
|
1936
|
-
private _applyUngroupedRules;
|
|
1937
|
-
/**
|
|
1938
|
-
* Determines whether a transport should receive a log entry based on group routing rules.
|
|
1939
|
-
*/
|
|
1940
|
-
private _shouldTransportReceiveLog;
|
|
1941
|
-
_formatMessage(messages?: MessageDataType[]): void;
|
|
1942
|
-
_formatLog({
|
|
1943
|
-
logLevel,
|
|
1944
|
-
params,
|
|
1945
|
-
metadata,
|
|
1946
|
-
rootData,
|
|
1947
|
-
err,
|
|
1948
|
-
context,
|
|
1949
|
-
groups
|
|
1950
|
-
}: FormatLogParams): void | Promise<void>;
|
|
1951
|
-
/**
|
|
1952
|
-
* Resolves any Promise values in metadata (from async lazy callbacks)
|
|
1953
|
-
* and then processes the log entry. Context is already fully resolved.
|
|
1954
|
-
*/
|
|
1955
|
-
private _resolveAsyncAndProcess;
|
|
1956
|
-
/**
|
|
1957
|
-
* Logs error entries for lazy evaluation failures.
|
|
1958
|
-
* Calls _processLog directly to bypass lazy evaluation and prevent recursion.
|
|
1959
|
-
*/
|
|
1960
|
-
private _logLazyEvalErrors;
|
|
1961
|
-
/**
|
|
1962
|
-
* Logs error entries for async lazy values found in context.
|
|
1963
|
-
* Async lazy values are only supported in metadata, not context.
|
|
1964
|
-
*/
|
|
1965
|
-
private _logAsyncLazyContextErrors;
|
|
1966
|
-
/**
|
|
1967
|
-
* Processes a log entry after lazy values have been fully resolved.
|
|
1968
|
-
* Handles data assembly, plugins, and transport dispatch.
|
|
1969
|
-
*/
|
|
1970
|
-
private _processLog;
|
|
1971
|
-
} //#endregion
|
|
1972
|
-
//#region src/LogBuilder.d.ts
|
|
1973
|
-
/**
|
|
1974
|
-
* A class that contains methods to specify log metadata and an error and assembles
|
|
1975
|
-
* it to form a data object that can be passed into the transport.
|
|
1976
|
-
*/
|
|
1977
|
-
declare class LogBuilder implements ILogBuilder<LogBuilder, boolean> {
|
|
1978
|
-
private err;
|
|
1979
|
-
private metadata;
|
|
1980
|
-
private structuredLogger;
|
|
1981
|
-
private hasMetadata;
|
|
1982
|
-
private pluginManager;
|
|
1983
|
-
private _groups;
|
|
1984
|
-
constructor(structuredLogger: LogLayer$1);
|
|
1985
|
-
/**
|
|
1986
|
-
* Specifies metadata to include with the log message
|
|
1987
|
-
*
|
|
1988
|
-
* @see {@link https://loglayer.dev/logging-api/metadata.html | Metadata Docs}
|
|
1989
|
-
*/
|
|
1990
|
-
withMetadata(metadata?: LogLayerMetadata): any;
|
|
1991
|
-
/**
|
|
1992
|
-
* Specifies an Error to include with the log message
|
|
1993
|
-
*
|
|
1994
|
-
* @see {@link https://loglayer.dev/logging-api/error-handling.html | Error Handling Docs}
|
|
1995
|
-
*/
|
|
1996
|
-
withError(error: any): any;
|
|
1997
|
-
/**
|
|
1998
|
-
* Tags this log entry with one or more groups for routing.
|
|
1999
|
-
*
|
|
2000
|
-
* @see {@link https://loglayer.dev/logging-api/groups.html | Groups Docs}
|
|
2001
|
-
*/
|
|
2002
|
-
withGroup(group: string | string[]): any;
|
|
2003
|
-
/**
|
|
2004
|
-
* Sends a log message to the logging library under an info log level.
|
|
2005
|
-
*
|
|
2006
|
-
* Supports tagged template syntax:
|
|
2007
|
-
* ```typescript
|
|
2008
|
-
* log.withMetadata({ userId }).info`User ${userId} logged in`;
|
|
2009
|
-
* ```
|
|
2010
|
-
*/
|
|
2011
|
-
info(...args: TaggedTemplateOrMessageArgs): void | Promise<void>;
|
|
2012
|
-
/**
|
|
2013
|
-
* Sends a log message to the logging library under the warn log level
|
|
2014
|
-
*
|
|
2015
|
-
* Supports tagged template syntax:
|
|
2016
|
-
* ```typescript
|
|
2017
|
-
* log.withMetadata({ requestId }).warn`Request ${requestId} timed out`;
|
|
2018
|
-
* ```
|
|
2019
|
-
*/
|
|
2020
|
-
warn(...args: TaggedTemplateOrMessageArgs): void | Promise<void>;
|
|
2021
|
-
/**
|
|
2022
|
-
* Sends a log message to the logging library under the error log level
|
|
2023
|
-
*
|
|
2024
|
-
* Supports tagged template syntax:
|
|
2025
|
-
* ```typescript
|
|
2026
|
-
* log.withError(err).error`Failed to process ${taskId}`;
|
|
2027
|
-
* ```
|
|
2028
|
-
*/
|
|
2029
|
-
error(...args: TaggedTemplateOrMessageArgs): void | Promise<void>;
|
|
2030
|
-
/**
|
|
2031
|
-
* Sends a log message to the logging library under the debug log level
|
|
2032
|
-
*
|
|
2033
|
-
* Supports tagged template syntax:
|
|
2034
|
-
* ```typescript
|
|
2035
|
-
* log.withMetadata({ cacheKey }).debug`Cache hit for ${cacheKey}`;
|
|
2036
|
-
* ```
|
|
2037
|
-
*/
|
|
2038
|
-
debug(...args: TaggedTemplateOrMessageArgs): void | Promise<void>;
|
|
2039
|
-
/**
|
|
2040
|
-
* Sends a log message to the logging library under the trace log level
|
|
2041
|
-
*
|
|
2042
|
-
* Supports tagged template syntax:
|
|
2043
|
-
* ```typescript
|
|
2044
|
-
* log.withMetadata({ functionName }).trace`Entering ${functionName}`;
|
|
2045
|
-
* ```
|
|
2046
|
-
*/
|
|
2047
|
-
trace(...args: TaggedTemplateOrMessageArgs): void | Promise<void>;
|
|
2048
|
-
/**
|
|
2049
|
-
* Sends a log message to the logging library under the fatal log level
|
|
2050
|
-
*
|
|
2051
|
-
* Supports tagged template syntax:
|
|
2052
|
-
* ```typescript
|
|
2053
|
-
* log.withError(err).fatal`System crash: ${reason}`;
|
|
2054
|
-
* ```
|
|
2055
|
-
*/
|
|
2056
|
-
fatal(...args: TaggedTemplateOrMessageArgs): void | Promise<void>;
|
|
2057
|
-
/**
|
|
2058
|
-
* All logging inputs are dropped and stops sending logs to the logging library.
|
|
2059
|
-
*/
|
|
2060
|
-
disableLogging(): any;
|
|
2061
|
-
/**
|
|
2062
|
-
* Enable sending logs to the logging library.
|
|
2063
|
-
*/
|
|
2064
|
-
enableLogging(): any;
|
|
2065
|
-
private formatLog;
|
|
2066
|
-
} //#endregion
|
|
2067
|
-
//#region src/mixins.d.ts
|
|
2068
|
-
/**
|
|
2069
|
-
* Adds one or more mixins to LogLayer.
|
|
2070
|
-
* @param mixin - The mixin(s) to register. Can be a single mixin registration or an array of mixin registrations.
|
|
2071
|
-
*/
|
|
2072
|
-
//#endregion
|
|
2073
4
|
//#region src/types.d.ts
|
|
2074
5
|
/**
|
|
2075
6
|
* Options for creating a BufferedMetricsLogger instance.
|
|
@@ -2176,6 +107,8 @@ interface IDatadogMetricsMixin<_T> {
|
|
|
2176
107
|
declare module "loglayer" {
|
|
2177
108
|
interface LogLayer extends IDatadogMetricsMixin<LogLayer> {}
|
|
2178
109
|
interface MockLogLayer extends IDatadogMetricsMixin<MockLogLayer> {}
|
|
110
|
+
}
|
|
111
|
+
declare module "@loglayer/shared" {
|
|
2179
112
|
interface ILogLayer<This> extends IDatadogMetricsMixin<This> {}
|
|
2180
113
|
}
|
|
2181
114
|
//#endregion
|