@logtape/logtape 0.10.0 → 0.11.0-dev.174
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/esm/formatter.js +76 -0
- package/esm/logger.js +38 -1
- package/esm/mod.js +1 -1
- package/package.json +1 -1
- package/script/formatter.js +77 -0
- package/script/logger.js +38 -1
- package/script/mod.js +2 -1
- package/types/formatter.d.ts +47 -0
- package/types/formatter.d.ts.map +1 -1
- package/types/logger.d.ts +160 -10
- package/types/logger.d.ts.map +1 -1
- package/types/mod.d.ts +1 -1
- package/types/mod.d.ts.map +1 -1
package/esm/formatter.js
CHANGED
|
@@ -228,6 +228,82 @@ export function getAnsiColorFormatter(options = {}) {
|
|
|
228
228
|
* @since 0.5.0
|
|
229
229
|
*/
|
|
230
230
|
export const ansiColorFormatter = getAnsiColorFormatter();
|
|
231
|
+
/**
|
|
232
|
+
* Get a [JSON Lines] formatter with the specified options.
|
|
233
|
+
*
|
|
234
|
+
* [JSON Lines]: https://jsonlines.org/
|
|
235
|
+
* @param options The options for the JSON Lines formatter.
|
|
236
|
+
* @returns The JSON Lines formatter.
|
|
237
|
+
* @since 0.11.0
|
|
238
|
+
*/
|
|
239
|
+
export function getJsonLinesFormatter(options = {}) {
|
|
240
|
+
let joinCategory;
|
|
241
|
+
if (typeof options.categorySeparator === "function") {
|
|
242
|
+
joinCategory = options.categorySeparator;
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
const separator = options.categorySeparator ?? ".";
|
|
246
|
+
joinCategory = (category) => category.join(separator);
|
|
247
|
+
}
|
|
248
|
+
let getMessage;
|
|
249
|
+
if (options.message === "template") {
|
|
250
|
+
getMessage = (record) => {
|
|
251
|
+
if (typeof record.rawMessage === "string") {
|
|
252
|
+
return record.rawMessage;
|
|
253
|
+
}
|
|
254
|
+
let msg = "";
|
|
255
|
+
for (let i = 0; i < record.rawMessage.length; i++) {
|
|
256
|
+
msg += i % 2 < 1 ? record.rawMessage[i] : "{}";
|
|
257
|
+
}
|
|
258
|
+
return msg;
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
getMessage = (record) => {
|
|
263
|
+
let msg = "";
|
|
264
|
+
for (let i = 0; i < record.message.length; i++) {
|
|
265
|
+
msg += i % 2 < 1
|
|
266
|
+
? record.message[i]
|
|
267
|
+
: JSON.stringify(record.message[i]);
|
|
268
|
+
}
|
|
269
|
+
return msg;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
const propertiesOption = options.properties ?? "nest:properties";
|
|
273
|
+
let getProperties;
|
|
274
|
+
if (propertiesOption === "flatten") {
|
|
275
|
+
getProperties = (properties) => properties;
|
|
276
|
+
}
|
|
277
|
+
else if (propertiesOption.startsWith("prepend:")) {
|
|
278
|
+
const prefix = propertiesOption.substring(8);
|
|
279
|
+
if (prefix === "") {
|
|
280
|
+
throw new TypeError(`Invalid properties option: ${JSON.stringify(propertiesOption)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`);
|
|
281
|
+
}
|
|
282
|
+
getProperties = (properties) => {
|
|
283
|
+
const result = {};
|
|
284
|
+
for (const key in properties) {
|
|
285
|
+
result[`${prefix}${key}`] = properties[key];
|
|
286
|
+
}
|
|
287
|
+
return result;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
else if (propertiesOption.startsWith("nest:")) {
|
|
291
|
+
const key = propertiesOption.substring(5);
|
|
292
|
+
getProperties = (properties) => ({ [key]: properties });
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
throw new TypeError(`Invalid properties option: ${JSON.stringify(propertiesOption)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`);
|
|
296
|
+
}
|
|
297
|
+
return (record) => {
|
|
298
|
+
return JSON.stringify({
|
|
299
|
+
"@timestamp": new Date(record.timestamp).toISOString(),
|
|
300
|
+
level: record.level === "warning" ? "WARN" : record.level.toUpperCase(),
|
|
301
|
+
message: getMessage(record),
|
|
302
|
+
logger: joinCategory(record.category),
|
|
303
|
+
...getProperties(record.properties),
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
}
|
|
231
307
|
/**
|
|
232
308
|
* The styles for the log level in the console.
|
|
233
309
|
*/
|
package/esm/logger.js
CHANGED
|
@@ -258,6 +258,9 @@ export class LoggerImpl {
|
|
|
258
258
|
else if (typeof message === "function") {
|
|
259
259
|
this.logLazily("debug", message);
|
|
260
260
|
}
|
|
261
|
+
else if (!Array.isArray(message)) {
|
|
262
|
+
this.log("debug", "{*}", message);
|
|
263
|
+
}
|
|
261
264
|
else {
|
|
262
265
|
this.logTemplate("debug", message, values);
|
|
263
266
|
}
|
|
@@ -269,6 +272,9 @@ export class LoggerImpl {
|
|
|
269
272
|
else if (typeof message === "function") {
|
|
270
273
|
this.logLazily("info", message);
|
|
271
274
|
}
|
|
275
|
+
else if (!Array.isArray(message)) {
|
|
276
|
+
this.log("info", "{*}", message);
|
|
277
|
+
}
|
|
272
278
|
else {
|
|
273
279
|
this.logTemplate("info", message, values);
|
|
274
280
|
}
|
|
@@ -280,6 +286,9 @@ export class LoggerImpl {
|
|
|
280
286
|
else if (typeof message === "function") {
|
|
281
287
|
this.logLazily("warning", message);
|
|
282
288
|
}
|
|
289
|
+
else if (!Array.isArray(message)) {
|
|
290
|
+
this.log("warning", "{*}", message);
|
|
291
|
+
}
|
|
283
292
|
else {
|
|
284
293
|
this.logTemplate("warning", message, values);
|
|
285
294
|
}
|
|
@@ -291,6 +300,9 @@ export class LoggerImpl {
|
|
|
291
300
|
else if (typeof message === "function") {
|
|
292
301
|
this.logLazily("error", message);
|
|
293
302
|
}
|
|
303
|
+
else if (!Array.isArray(message)) {
|
|
304
|
+
this.log("error", "{*}", message);
|
|
305
|
+
}
|
|
294
306
|
else {
|
|
295
307
|
this.logTemplate("error", message, values);
|
|
296
308
|
}
|
|
@@ -302,6 +314,9 @@ export class LoggerImpl {
|
|
|
302
314
|
else if (typeof message === "function") {
|
|
303
315
|
this.logLazily("fatal", message);
|
|
304
316
|
}
|
|
317
|
+
else if (!Array.isArray(message)) {
|
|
318
|
+
this.log("fatal", "{*}", message);
|
|
319
|
+
}
|
|
305
320
|
else {
|
|
306
321
|
this.logTemplate("fatal", message, values);
|
|
307
322
|
}
|
|
@@ -362,6 +377,9 @@ export class LoggerCtx {
|
|
|
362
377
|
else if (typeof message === "function") {
|
|
363
378
|
this.logLazily("debug", message);
|
|
364
379
|
}
|
|
380
|
+
else if (!Array.isArray(message)) {
|
|
381
|
+
this.log("debug", "{*}", message);
|
|
382
|
+
}
|
|
365
383
|
else {
|
|
366
384
|
this.logTemplate("debug", message, values);
|
|
367
385
|
}
|
|
@@ -373,6 +391,9 @@ export class LoggerCtx {
|
|
|
373
391
|
else if (typeof message === "function") {
|
|
374
392
|
this.logLazily("info", message);
|
|
375
393
|
}
|
|
394
|
+
else if (!Array.isArray(message)) {
|
|
395
|
+
this.log("info", "{*}", message);
|
|
396
|
+
}
|
|
376
397
|
else {
|
|
377
398
|
this.logTemplate("info", message, values);
|
|
378
399
|
}
|
|
@@ -384,6 +405,9 @@ export class LoggerCtx {
|
|
|
384
405
|
else if (typeof message === "function") {
|
|
385
406
|
this.logLazily("warning", message);
|
|
386
407
|
}
|
|
408
|
+
else if (!Array.isArray(message)) {
|
|
409
|
+
this.log("warning", "{*}", message);
|
|
410
|
+
}
|
|
387
411
|
else {
|
|
388
412
|
this.logTemplate("warning", message, values);
|
|
389
413
|
}
|
|
@@ -395,6 +419,9 @@ export class LoggerCtx {
|
|
|
395
419
|
else if (typeof message === "function") {
|
|
396
420
|
this.logLazily("error", message);
|
|
397
421
|
}
|
|
422
|
+
else if (!Array.isArray(message)) {
|
|
423
|
+
this.log("error", "{*}", message);
|
|
424
|
+
}
|
|
398
425
|
else {
|
|
399
426
|
this.logTemplate("error", message, values);
|
|
400
427
|
}
|
|
@@ -406,6 +433,9 @@ export class LoggerCtx {
|
|
|
406
433
|
else if (typeof message === "function") {
|
|
407
434
|
this.logLazily("fatal", message);
|
|
408
435
|
}
|
|
436
|
+
else if (!Array.isArray(message)) {
|
|
437
|
+
this.log("fatal", "{*}", message);
|
|
438
|
+
}
|
|
409
439
|
else {
|
|
410
440
|
this.logTemplate("fatal", message, values);
|
|
411
441
|
}
|
|
@@ -445,7 +475,14 @@ export function parseMessageTemplate(template, properties) {
|
|
|
445
475
|
else if (char === "}") {
|
|
446
476
|
// End of a placeholder
|
|
447
477
|
let prop;
|
|
448
|
-
if (part.match(/^\s
|
|
478
|
+
if (part.match(/^\s*\*\s*$/)) {
|
|
479
|
+
prop = part in properties
|
|
480
|
+
? properties[part]
|
|
481
|
+
: "*" in properties
|
|
482
|
+
? properties["*"]
|
|
483
|
+
: properties;
|
|
484
|
+
}
|
|
485
|
+
else if (part.match(/^\s|\s$/)) {
|
|
449
486
|
prop = part in properties ? properties[part] : properties[part.trim()];
|
|
450
487
|
}
|
|
451
488
|
else {
|
package/esm/mod.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ConfigError, configure, configureSync, dispose, disposeSync, getConfig, reset, resetSync, } from "./config.js";
|
|
2
2
|
export { withContext } from "./context.js";
|
|
3
3
|
export { getLevelFilter, toFilter, } from "./filter.js";
|
|
4
|
-
export { ansiColorFormatter, defaultConsoleFormatter, defaultTextFormatter, getAnsiColorFormatter, getTextFormatter, } from "./formatter.js";
|
|
4
|
+
export { ansiColorFormatter, defaultConsoleFormatter, defaultTextFormatter, getAnsiColorFormatter, getJsonLinesFormatter, getTextFormatter, } from "./formatter.js";
|
|
5
5
|
export { compareLogLevel, isLogLevel, parseLogLevel, } from "./level.js";
|
|
6
6
|
export { getLogger } from "./logger.js";
|
|
7
7
|
export { getConsoleSink, getStreamSink, withFilter, } from "./sink.js";
|
package/package.json
CHANGED
package/script/formatter.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ansiColorFormatter = exports.defaultTextFormatter = void 0;
|
|
7
7
|
exports.getTextFormatter = getTextFormatter;
|
|
8
8
|
exports.getAnsiColorFormatter = getAnsiColorFormatter;
|
|
9
|
+
exports.getJsonLinesFormatter = getJsonLinesFormatter;
|
|
9
10
|
exports.defaultConsoleFormatter = defaultConsoleFormatter;
|
|
10
11
|
const nodeUtil_js_1 = __importDefault(require("./nodeUtil.js"));
|
|
11
12
|
/**
|
|
@@ -237,6 +238,82 @@ function getAnsiColorFormatter(options = {}) {
|
|
|
237
238
|
* @since 0.5.0
|
|
238
239
|
*/
|
|
239
240
|
exports.ansiColorFormatter = getAnsiColorFormatter();
|
|
241
|
+
/**
|
|
242
|
+
* Get a [JSON Lines] formatter with the specified options.
|
|
243
|
+
*
|
|
244
|
+
* [JSON Lines]: https://jsonlines.org/
|
|
245
|
+
* @param options The options for the JSON Lines formatter.
|
|
246
|
+
* @returns The JSON Lines formatter.
|
|
247
|
+
* @since 0.11.0
|
|
248
|
+
*/
|
|
249
|
+
function getJsonLinesFormatter(options = {}) {
|
|
250
|
+
let joinCategory;
|
|
251
|
+
if (typeof options.categorySeparator === "function") {
|
|
252
|
+
joinCategory = options.categorySeparator;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
const separator = options.categorySeparator ?? ".";
|
|
256
|
+
joinCategory = (category) => category.join(separator);
|
|
257
|
+
}
|
|
258
|
+
let getMessage;
|
|
259
|
+
if (options.message === "template") {
|
|
260
|
+
getMessage = (record) => {
|
|
261
|
+
if (typeof record.rawMessage === "string") {
|
|
262
|
+
return record.rawMessage;
|
|
263
|
+
}
|
|
264
|
+
let msg = "";
|
|
265
|
+
for (let i = 0; i < record.rawMessage.length; i++) {
|
|
266
|
+
msg += i % 2 < 1 ? record.rawMessage[i] : "{}";
|
|
267
|
+
}
|
|
268
|
+
return msg;
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
getMessage = (record) => {
|
|
273
|
+
let msg = "";
|
|
274
|
+
for (let i = 0; i < record.message.length; i++) {
|
|
275
|
+
msg += i % 2 < 1
|
|
276
|
+
? record.message[i]
|
|
277
|
+
: JSON.stringify(record.message[i]);
|
|
278
|
+
}
|
|
279
|
+
return msg;
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const propertiesOption = options.properties ?? "nest:properties";
|
|
283
|
+
let getProperties;
|
|
284
|
+
if (propertiesOption === "flatten") {
|
|
285
|
+
getProperties = (properties) => properties;
|
|
286
|
+
}
|
|
287
|
+
else if (propertiesOption.startsWith("prepend:")) {
|
|
288
|
+
const prefix = propertiesOption.substring(8);
|
|
289
|
+
if (prefix === "") {
|
|
290
|
+
throw new TypeError(`Invalid properties option: ${JSON.stringify(propertiesOption)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`);
|
|
291
|
+
}
|
|
292
|
+
getProperties = (properties) => {
|
|
293
|
+
const result = {};
|
|
294
|
+
for (const key in properties) {
|
|
295
|
+
result[`${prefix}${key}`] = properties[key];
|
|
296
|
+
}
|
|
297
|
+
return result;
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
else if (propertiesOption.startsWith("nest:")) {
|
|
301
|
+
const key = propertiesOption.substring(5);
|
|
302
|
+
getProperties = (properties) => ({ [key]: properties });
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
throw new TypeError(`Invalid properties option: ${JSON.stringify(propertiesOption)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`);
|
|
306
|
+
}
|
|
307
|
+
return (record) => {
|
|
308
|
+
return JSON.stringify({
|
|
309
|
+
"@timestamp": new Date(record.timestamp).toISOString(),
|
|
310
|
+
level: record.level === "warning" ? "WARN" : record.level.toUpperCase(),
|
|
311
|
+
message: getMessage(record),
|
|
312
|
+
logger: joinCategory(record.category),
|
|
313
|
+
...getProperties(record.properties),
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
}
|
|
240
317
|
/**
|
|
241
318
|
* The styles for the log level in the console.
|
|
242
319
|
*/
|
package/script/logger.js
CHANGED
|
@@ -287,6 +287,9 @@ class LoggerImpl {
|
|
|
287
287
|
else if (typeof message === "function") {
|
|
288
288
|
this.logLazily("debug", message);
|
|
289
289
|
}
|
|
290
|
+
else if (!Array.isArray(message)) {
|
|
291
|
+
this.log("debug", "{*}", message);
|
|
292
|
+
}
|
|
290
293
|
else {
|
|
291
294
|
this.logTemplate("debug", message, values);
|
|
292
295
|
}
|
|
@@ -298,6 +301,9 @@ class LoggerImpl {
|
|
|
298
301
|
else if (typeof message === "function") {
|
|
299
302
|
this.logLazily("info", message);
|
|
300
303
|
}
|
|
304
|
+
else if (!Array.isArray(message)) {
|
|
305
|
+
this.log("info", "{*}", message);
|
|
306
|
+
}
|
|
301
307
|
else {
|
|
302
308
|
this.logTemplate("info", message, values);
|
|
303
309
|
}
|
|
@@ -309,6 +315,9 @@ class LoggerImpl {
|
|
|
309
315
|
else if (typeof message === "function") {
|
|
310
316
|
this.logLazily("warning", message);
|
|
311
317
|
}
|
|
318
|
+
else if (!Array.isArray(message)) {
|
|
319
|
+
this.log("warning", "{*}", message);
|
|
320
|
+
}
|
|
312
321
|
else {
|
|
313
322
|
this.logTemplate("warning", message, values);
|
|
314
323
|
}
|
|
@@ -320,6 +329,9 @@ class LoggerImpl {
|
|
|
320
329
|
else if (typeof message === "function") {
|
|
321
330
|
this.logLazily("error", message);
|
|
322
331
|
}
|
|
332
|
+
else if (!Array.isArray(message)) {
|
|
333
|
+
this.log("error", "{*}", message);
|
|
334
|
+
}
|
|
323
335
|
else {
|
|
324
336
|
this.logTemplate("error", message, values);
|
|
325
337
|
}
|
|
@@ -331,6 +343,9 @@ class LoggerImpl {
|
|
|
331
343
|
else if (typeof message === "function") {
|
|
332
344
|
this.logLazily("fatal", message);
|
|
333
345
|
}
|
|
346
|
+
else if (!Array.isArray(message)) {
|
|
347
|
+
this.log("fatal", "{*}", message);
|
|
348
|
+
}
|
|
334
349
|
else {
|
|
335
350
|
this.logTemplate("fatal", message, values);
|
|
336
351
|
}
|
|
@@ -392,6 +407,9 @@ class LoggerCtx {
|
|
|
392
407
|
else if (typeof message === "function") {
|
|
393
408
|
this.logLazily("debug", message);
|
|
394
409
|
}
|
|
410
|
+
else if (!Array.isArray(message)) {
|
|
411
|
+
this.log("debug", "{*}", message);
|
|
412
|
+
}
|
|
395
413
|
else {
|
|
396
414
|
this.logTemplate("debug", message, values);
|
|
397
415
|
}
|
|
@@ -403,6 +421,9 @@ class LoggerCtx {
|
|
|
403
421
|
else if (typeof message === "function") {
|
|
404
422
|
this.logLazily("info", message);
|
|
405
423
|
}
|
|
424
|
+
else if (!Array.isArray(message)) {
|
|
425
|
+
this.log("info", "{*}", message);
|
|
426
|
+
}
|
|
406
427
|
else {
|
|
407
428
|
this.logTemplate("info", message, values);
|
|
408
429
|
}
|
|
@@ -414,6 +435,9 @@ class LoggerCtx {
|
|
|
414
435
|
else if (typeof message === "function") {
|
|
415
436
|
this.logLazily("warning", message);
|
|
416
437
|
}
|
|
438
|
+
else if (!Array.isArray(message)) {
|
|
439
|
+
this.log("warning", "{*}", message);
|
|
440
|
+
}
|
|
417
441
|
else {
|
|
418
442
|
this.logTemplate("warning", message, values);
|
|
419
443
|
}
|
|
@@ -425,6 +449,9 @@ class LoggerCtx {
|
|
|
425
449
|
else if (typeof message === "function") {
|
|
426
450
|
this.logLazily("error", message);
|
|
427
451
|
}
|
|
452
|
+
else if (!Array.isArray(message)) {
|
|
453
|
+
this.log("error", "{*}", message);
|
|
454
|
+
}
|
|
428
455
|
else {
|
|
429
456
|
this.logTemplate("error", message, values);
|
|
430
457
|
}
|
|
@@ -436,6 +463,9 @@ class LoggerCtx {
|
|
|
436
463
|
else if (typeof message === "function") {
|
|
437
464
|
this.logLazily("fatal", message);
|
|
438
465
|
}
|
|
466
|
+
else if (!Array.isArray(message)) {
|
|
467
|
+
this.log("fatal", "{*}", message);
|
|
468
|
+
}
|
|
439
469
|
else {
|
|
440
470
|
this.logTemplate("fatal", message, values);
|
|
441
471
|
}
|
|
@@ -476,7 +506,14 @@ function parseMessageTemplate(template, properties) {
|
|
|
476
506
|
else if (char === "}") {
|
|
477
507
|
// End of a placeholder
|
|
478
508
|
let prop;
|
|
479
|
-
if (part.match(/^\s
|
|
509
|
+
if (part.match(/^\s*\*\s*$/)) {
|
|
510
|
+
prop = part in properties
|
|
511
|
+
? properties[part]
|
|
512
|
+
: "*" in properties
|
|
513
|
+
? properties["*"]
|
|
514
|
+
: properties;
|
|
515
|
+
}
|
|
516
|
+
else if (part.match(/^\s|\s$/)) {
|
|
480
517
|
prop = part in properties ? properties[part] : properties[part.trim()];
|
|
481
518
|
}
|
|
482
519
|
else {
|
package/script/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withFilter = exports.getStreamSink = exports.getConsoleSink = exports.getLogger = exports.parseLogLevel = exports.isLogLevel = exports.compareLogLevel = exports.getTextFormatter = exports.getAnsiColorFormatter = exports.defaultTextFormatter = exports.defaultConsoleFormatter = exports.ansiColorFormatter = exports.toFilter = exports.getLevelFilter = exports.withContext = exports.resetSync = exports.reset = exports.getConfig = exports.disposeSync = exports.dispose = exports.configureSync = exports.configure = exports.ConfigError = void 0;
|
|
3
|
+
exports.withFilter = exports.getStreamSink = exports.getConsoleSink = exports.getLogger = exports.parseLogLevel = exports.isLogLevel = exports.compareLogLevel = exports.getTextFormatter = exports.getJsonLinesFormatter = exports.getAnsiColorFormatter = exports.defaultTextFormatter = exports.defaultConsoleFormatter = exports.ansiColorFormatter = exports.toFilter = exports.getLevelFilter = exports.withContext = exports.resetSync = exports.reset = exports.getConfig = exports.disposeSync = exports.dispose = exports.configureSync = exports.configure = exports.ConfigError = void 0;
|
|
4
4
|
var config_js_1 = require("./config.js");
|
|
5
5
|
Object.defineProperty(exports, "ConfigError", { enumerable: true, get: function () { return config_js_1.ConfigError; } });
|
|
6
6
|
Object.defineProperty(exports, "configure", { enumerable: true, get: function () { return config_js_1.configure; } });
|
|
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "ansiColorFormatter", { enumerable: true, get: fu
|
|
|
20
20
|
Object.defineProperty(exports, "defaultConsoleFormatter", { enumerable: true, get: function () { return formatter_js_1.defaultConsoleFormatter; } });
|
|
21
21
|
Object.defineProperty(exports, "defaultTextFormatter", { enumerable: true, get: function () { return formatter_js_1.defaultTextFormatter; } });
|
|
22
22
|
Object.defineProperty(exports, "getAnsiColorFormatter", { enumerable: true, get: function () { return formatter_js_1.getAnsiColorFormatter; } });
|
|
23
|
+
Object.defineProperty(exports, "getJsonLinesFormatter", { enumerable: true, get: function () { return formatter_js_1.getJsonLinesFormatter; } });
|
|
23
24
|
Object.defineProperty(exports, "getTextFormatter", { enumerable: true, get: function () { return formatter_js_1.getTextFormatter; } });
|
|
24
25
|
var level_js_1 = require("./level.js");
|
|
25
26
|
Object.defineProperty(exports, "compareLogLevel", { enumerable: true, get: function () { return level_js_1.compareLogLevel; } });
|
package/types/formatter.d.ts
CHANGED
|
@@ -241,6 +241,53 @@ export declare function getAnsiColorFormatter(options?: AnsiColorFormatterOption
|
|
|
241
241
|
* @since 0.5.0
|
|
242
242
|
*/
|
|
243
243
|
export declare const ansiColorFormatter: TextFormatter;
|
|
244
|
+
/**
|
|
245
|
+
* Options for the {@link getJsonLinesFormatter} function.
|
|
246
|
+
* @since 0.11.0
|
|
247
|
+
*/
|
|
248
|
+
export interface JsonLinesFormatterOptions {
|
|
249
|
+
/**
|
|
250
|
+
* The separator between category names. For example, if the separator is
|
|
251
|
+
* `"."`, the category `["a", "b", "c"]` will be formatted as `"a.b.c"`.
|
|
252
|
+
* If this is a function, it will be called with the category array and
|
|
253
|
+
* should return a string or an array of strings, which will be used
|
|
254
|
+
* for rendering the category.
|
|
255
|
+
*
|
|
256
|
+
* @default `"."`
|
|
257
|
+
*/
|
|
258
|
+
readonly categorySeparator?: string | ((category: readonly string[]) => string | readonly string[]);
|
|
259
|
+
/**
|
|
260
|
+
* The message format. This can be one of the following:
|
|
261
|
+
*
|
|
262
|
+
* - `"template"`: The raw message template is used as the message.
|
|
263
|
+
* - `"rendered"`: The message is rendered with the values.
|
|
264
|
+
*
|
|
265
|
+
* @default `"rendered"`
|
|
266
|
+
*/
|
|
267
|
+
readonly message?: "template" | "rendered";
|
|
268
|
+
/**
|
|
269
|
+
* The properties format. This can be one of the following:
|
|
270
|
+
*
|
|
271
|
+
* - `"flatten"`: The properties are flattened into the root object.
|
|
272
|
+
* - `"prepend:<prefix>"`: The properties are prepended with the given prefix
|
|
273
|
+
* (e.g., `"prepend:ctx_"` will prepend `ctx_` to each property key).
|
|
274
|
+
* - `"nest:<key>"`: The properties are nested under the given key
|
|
275
|
+
* (e.g., `"nest:properties"` will nest the properties under the
|
|
276
|
+
* `properties` key).
|
|
277
|
+
*
|
|
278
|
+
* @default `"nest:properties"`
|
|
279
|
+
*/
|
|
280
|
+
readonly properties?: "flatten" | `prepend:${string}` | `nest:${string}`;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Get a [JSON Lines] formatter with the specified options.
|
|
284
|
+
*
|
|
285
|
+
* [JSON Lines]: https://jsonlines.org/
|
|
286
|
+
* @param options The options for the JSON Lines formatter.
|
|
287
|
+
* @returns The JSON Lines formatter.
|
|
288
|
+
* @since 0.11.0
|
|
289
|
+
*/
|
|
290
|
+
export declare function getJsonLinesFormatter(options?: JsonLinesFormatterOptions): TextFormatter;
|
|
244
291
|
/**
|
|
245
292
|
* A console formatter is a function that accepts a log record and returns
|
|
246
293
|
* an array of arguments to pass to {@link console.log}.
|
package/types/formatter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,MA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GAOG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,yBAA8B,GACtC,aAAa,CAiDf;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAuC,CAAC;AAEzE;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;;;;OAQG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EACvB,MAAM,GACN,CAAC,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,KAAK,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC;IAElE;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAE3C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,GAAG,WAAW,MAAM,EAAE,GAAG,QAAQ,MAAM,EAAE,CAAC;CAC1E;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,yBAA8B,GACtC,aAAa,CA4Ef;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,OAAO,EAAE,CAAC;AAazE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,OAAO,EAAE,CA2B7E"}
|
package/types/logger.d.ts
CHANGED
|
@@ -108,6 +108,36 @@ export interface Logger {
|
|
|
108
108
|
* properties.
|
|
109
109
|
*/
|
|
110
110
|
debug(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
111
|
+
/**
|
|
112
|
+
* Log a debug values with no message. This is useful when you
|
|
113
|
+
* want to log properties without a message, e.g., when you want to log
|
|
114
|
+
* the context of a request or an operation.
|
|
115
|
+
*
|
|
116
|
+
* ```typescript
|
|
117
|
+
* logger.debug({ method: 'GET', url: '/api/v1/resource' });
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* Note that this is a shorthand for:
|
|
121
|
+
*
|
|
122
|
+
* ```typescript
|
|
123
|
+
* logger.debug('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* If the properties are expensive to compute, you cannot use this shorthand
|
|
127
|
+
* and should use the following syntax instead:
|
|
128
|
+
*
|
|
129
|
+
* ```typescript
|
|
130
|
+
* logger.debug('{*}', () => ({
|
|
131
|
+
* method: expensiveMethod(),
|
|
132
|
+
* url: expensiveUrl(),
|
|
133
|
+
* }));
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @param properties The values to log. Note that this does not take
|
|
137
|
+
* a callback.
|
|
138
|
+
* @since 0.11.0
|
|
139
|
+
*/
|
|
140
|
+
debug(properties: Record<string, unknown>): void;
|
|
111
141
|
/**
|
|
112
142
|
* Lazily log a debug message. Use this when the message values are expensive
|
|
113
143
|
* to compute and should only be computed if the message is actually logged.
|
|
@@ -156,6 +186,36 @@ export interface Logger {
|
|
|
156
186
|
* properties.
|
|
157
187
|
*/
|
|
158
188
|
info(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
189
|
+
/**
|
|
190
|
+
* Log an informational values with no message. This is useful when you
|
|
191
|
+
* want to log properties without a message, e.g., when you want to log
|
|
192
|
+
* the context of a request or an operation.
|
|
193
|
+
*
|
|
194
|
+
* ```typescript
|
|
195
|
+
* logger.info({ method: 'GET', url: '/api/v1/resource' });
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* Note that this is a shorthand for:
|
|
199
|
+
*
|
|
200
|
+
* ```typescript
|
|
201
|
+
* logger.info('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* If the properties are expensive to compute, you cannot use this shorthand
|
|
205
|
+
* and should use the following syntax instead:
|
|
206
|
+
*
|
|
207
|
+
* ```typescript
|
|
208
|
+
* logger.info('{*}', () => ({
|
|
209
|
+
* method: expensiveMethod(),
|
|
210
|
+
* url: expensiveUrl(),
|
|
211
|
+
* }));
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* @param properties The values to log. Note that this does not take
|
|
215
|
+
* a callback.
|
|
216
|
+
* @since 0.11.0
|
|
217
|
+
*/
|
|
218
|
+
info(properties: Record<string, unknown>): void;
|
|
159
219
|
/**
|
|
160
220
|
* Lazily log an informational message. Use this when the message values are
|
|
161
221
|
* expensive to compute and should only be computed if the message is actually
|
|
@@ -205,6 +265,36 @@ export interface Logger {
|
|
|
205
265
|
* properties.
|
|
206
266
|
*/
|
|
207
267
|
warn(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
268
|
+
/**
|
|
269
|
+
* Log a warning values with no message. This is useful when you
|
|
270
|
+
* want to log properties without a message, e.g., when you want to log
|
|
271
|
+
* the context of a request or an operation.
|
|
272
|
+
*
|
|
273
|
+
* ```typescript
|
|
274
|
+
* logger.warn({ method: 'GET', url: '/api/v1/resource' });
|
|
275
|
+
* ```
|
|
276
|
+
*
|
|
277
|
+
* Note that this is a shorthand for:
|
|
278
|
+
*
|
|
279
|
+
* ```typescript
|
|
280
|
+
* logger.warn('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* If the properties are expensive to compute, you cannot use this shorthand
|
|
284
|
+
* and should use the following syntax instead:
|
|
285
|
+
*
|
|
286
|
+
* ```typescript
|
|
287
|
+
* logger.warn('{*}', () => ({
|
|
288
|
+
* method: expensiveMethod(),
|
|
289
|
+
* url: expensiveUrl(),
|
|
290
|
+
* }));
|
|
291
|
+
* ```
|
|
292
|
+
*
|
|
293
|
+
* @param properties The values to log. Note that this does not take
|
|
294
|
+
* a callback.
|
|
295
|
+
* @since 0.11.0
|
|
296
|
+
*/
|
|
297
|
+
warn(properties: Record<string, unknown>): void;
|
|
208
298
|
/**
|
|
209
299
|
* Lazily log a warning message. Use this when the message values are
|
|
210
300
|
* expensive to compute and should only be computed if the message is actually
|
|
@@ -254,6 +344,36 @@ export interface Logger {
|
|
|
254
344
|
* properties.
|
|
255
345
|
*/
|
|
256
346
|
error(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
347
|
+
/**
|
|
348
|
+
* Log an error values with no message. This is useful when you
|
|
349
|
+
* want to log properties without a message, e.g., when you want to log
|
|
350
|
+
* the context of a request or an operation.
|
|
351
|
+
*
|
|
352
|
+
* ```typescript
|
|
353
|
+
* logger.error({ method: 'GET', url: '/api/v1/resource' });
|
|
354
|
+
* ```
|
|
355
|
+
*
|
|
356
|
+
* Note that this is a shorthand for:
|
|
357
|
+
*
|
|
358
|
+
* ```typescript
|
|
359
|
+
* logger.error('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
360
|
+
* ```
|
|
361
|
+
*
|
|
362
|
+
* If the properties are expensive to compute, you cannot use this shorthand
|
|
363
|
+
* and should use the following syntax instead:
|
|
364
|
+
*
|
|
365
|
+
* ```typescript
|
|
366
|
+
* logger.error('{*}', () => ({
|
|
367
|
+
* method: expensiveMethod(),
|
|
368
|
+
* url: expensiveUrl(),
|
|
369
|
+
* }));
|
|
370
|
+
* ```
|
|
371
|
+
*
|
|
372
|
+
* @param properties The values to log. Note that this does not take
|
|
373
|
+
* a callback.
|
|
374
|
+
* @since 0.11.0
|
|
375
|
+
*/
|
|
376
|
+
error(properties: Record<string, unknown>): void;
|
|
257
377
|
/**
|
|
258
378
|
* Lazily log an error message. Use this when the message values are
|
|
259
379
|
* expensive to compute and should only be computed if the message is actually
|
|
@@ -303,6 +423,36 @@ export interface Logger {
|
|
|
303
423
|
* properties.
|
|
304
424
|
*/
|
|
305
425
|
fatal(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
426
|
+
/**
|
|
427
|
+
* Log a fatal error values with no message. This is useful when you
|
|
428
|
+
* want to log properties without a message, e.g., when you want to log
|
|
429
|
+
* the context of a request or an operation.
|
|
430
|
+
*
|
|
431
|
+
* ```typescript
|
|
432
|
+
* logger.fatal({ method: 'GET', url: '/api/v1/resource' });
|
|
433
|
+
* ```
|
|
434
|
+
*
|
|
435
|
+
* Note that this is a shorthand for:
|
|
436
|
+
*
|
|
437
|
+
* ```typescript
|
|
438
|
+
* logger.fatal('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
439
|
+
* ```
|
|
440
|
+
*
|
|
441
|
+
* If the properties are expensive to compute, you cannot use this shorthand
|
|
442
|
+
* and should use the following syntax instead:
|
|
443
|
+
*
|
|
444
|
+
* ```typescript
|
|
445
|
+
* logger.fatal('{*}', () => ({
|
|
446
|
+
* method: expensiveMethod(),
|
|
447
|
+
* url: expensiveUrl(),
|
|
448
|
+
* }));
|
|
449
|
+
* ```
|
|
450
|
+
*
|
|
451
|
+
* @param properties The values to log. Note that this does not take
|
|
452
|
+
* a callback.
|
|
453
|
+
* @since 0.11.0
|
|
454
|
+
*/
|
|
455
|
+
fatal(properties: Record<string, unknown>): void;
|
|
306
456
|
/**
|
|
307
457
|
* Lazily log a fatal error message. Use this when the message values are
|
|
308
458
|
* expensive to compute and should only be computed if the message is actually
|
|
@@ -377,11 +527,11 @@ export declare class LoggerImpl implements Logger {
|
|
|
377
527
|
log(level: LogLevel, rawMessage: string, properties: Record<string, unknown> | (() => Record<string, unknown>), bypassSinks?: Set<Sink>): void;
|
|
378
528
|
logLazily(level: LogLevel, callback: LogCallback, properties?: Record<string, unknown>): void;
|
|
379
529
|
logTemplate(level: LogLevel, messageTemplate: TemplateStringsArray, values: unknown[], properties?: Record<string, unknown>): void;
|
|
380
|
-
debug(message: TemplateStringsArray | string | LogCallback, ...values: unknown[]): void;
|
|
381
|
-
info(message: TemplateStringsArray | string | LogCallback, ...values: unknown[]): void;
|
|
382
|
-
warn(message: TemplateStringsArray | string | LogCallback, ...values: unknown[]): void;
|
|
383
|
-
error(message: TemplateStringsArray | string | LogCallback, ...values: unknown[]): void;
|
|
384
|
-
fatal(message: TemplateStringsArray | string | LogCallback, ...values: unknown[]): void;
|
|
530
|
+
debug(message: TemplateStringsArray | string | LogCallback | Record<string, unknown>, ...values: unknown[]): void;
|
|
531
|
+
info(message: TemplateStringsArray | string | LogCallback | Record<string, unknown>, ...values: unknown[]): void;
|
|
532
|
+
warn(message: TemplateStringsArray | string | LogCallback | Record<string, unknown>, ...values: unknown[]): void;
|
|
533
|
+
error(message: TemplateStringsArray | string | LogCallback | Record<string, unknown>, ...values: unknown[]): void;
|
|
534
|
+
fatal(message: TemplateStringsArray | string | LogCallback | Record<string, unknown>, ...values: unknown[]): void;
|
|
385
535
|
}
|
|
386
536
|
/**
|
|
387
537
|
* A logger implementation with contextual properties. Do not use this
|
|
@@ -399,11 +549,11 @@ export declare class LoggerCtx implements Logger {
|
|
|
399
549
|
log(level: LogLevel, message: string, properties: Record<string, unknown> | (() => Record<string, unknown>), bypassSinks?: Set<Sink>): void;
|
|
400
550
|
logLazily(level: LogLevel, callback: LogCallback): void;
|
|
401
551
|
logTemplate(level: LogLevel, messageTemplate: TemplateStringsArray, values: unknown[]): void;
|
|
402
|
-
debug(message: TemplateStringsArray | string | LogCallback, ...values: unknown[]): void;
|
|
403
|
-
info(message: TemplateStringsArray | string | LogCallback, ...values: unknown[]): void;
|
|
404
|
-
warn(message: TemplateStringsArray | string | LogCallback, ...values: unknown[]): void;
|
|
405
|
-
error(message: TemplateStringsArray | string | LogCallback, ...values: unknown[]): void;
|
|
406
|
-
fatal(message: TemplateStringsArray | string | LogCallback, ...values: unknown[]): void;
|
|
552
|
+
debug(message: TemplateStringsArray | string | LogCallback | Record<string, unknown>, ...values: unknown[]): void;
|
|
553
|
+
info(message: TemplateStringsArray | string | LogCallback | Record<string, unknown>, ...values: unknown[]): void;
|
|
554
|
+
warn(message: TemplateStringsArray | string | LogCallback | Record<string, unknown>, ...values: unknown[]): void;
|
|
555
|
+
error(message: TemplateStringsArray | string | LogCallback | Record<string, unknown>, ...values: unknown[]): void;
|
|
556
|
+
fatal(message: TemplateStringsArray | string | LogCallback | Record<string, unknown>, ...values: unknown[]): void;
|
|
407
557
|
}
|
|
408
558
|
/**
|
|
409
559
|
* Parse a message template into a message template array and a values array.
|
package/types/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CACN,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,GACvE,MAAM,CAAC;IAEV;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IAElD;;;;;;;;;OASG;IACH,KAAK,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC;IAE1E;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CACH,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,C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,OAAO,EACH,oBAAoB,GACpB,MAAM,GACN,WAAW,GACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3B,GAAG,MAAM,EAAE,OAAO,EAAE,GACnB,IAAI;IAYP,IAAI,CACF,OAAO,EACH,oBAAoB,GACpB,MAAM,GACN,WAAW,GACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3B,GAAG,MAAM,EAAE,OAAO,EAAE,GACnB,IAAI;IAYP,IAAI,CACF,OAAO,EACH,oBAAoB,GACpB,MAAM,GACN,WAAW,GACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3B,GAAG,MAAM,EAAE,OAAO,EAAE,GACnB,IAAI;IAgBP,KAAK,CACH,OAAO,EACH,oBAAoB,GACpB,MAAM,GACN,WAAW,GACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3B,GAAG,MAAM,EAAE,OAAO,EAAE,GACnB,IAAI;IAYP,KAAK,CACH,OAAO,EACH,oBAAoB,GACpB,MAAM,GACN,WAAW,GACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3B,GAAG,MAAM,EAAE,OAAO,EAAE,GACnB,IAAI;CAWR;AAOD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,SAAS,OAAO,EAAE,CA0CpB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,EAAE,SAAS,OAAO,EAAE,GACzB,OAAO,EAAE,CAOX"}
|
package/types/mod.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { type Config, ConfigError, configure, configureSync, dispose, disposeSync, getConfig, type LoggerConfig, reset, resetSync, } from "./config.js";
|
|
2
2
|
export { type ContextLocalStorage, withContext } from "./context.js";
|
|
3
3
|
export { type Filter, type FilterLike, getLevelFilter, toFilter, } from "./filter.js";
|
|
4
|
-
export { type AnsiColor, ansiColorFormatter, type AnsiColorFormatterOptions, type AnsiStyle, type ConsoleFormatter, defaultConsoleFormatter, defaultTextFormatter, type FormattedValues, getAnsiColorFormatter, getTextFormatter, type TextFormatter, type TextFormatterOptions, } from "./formatter.js";
|
|
4
|
+
export { type AnsiColor, ansiColorFormatter, type AnsiColorFormatterOptions, type AnsiStyle, type ConsoleFormatter, defaultConsoleFormatter, defaultTextFormatter, type FormattedValues, getAnsiColorFormatter, getJsonLinesFormatter, getTextFormatter, type JsonLinesFormatterOptions, type TextFormatter, type TextFormatterOptions, } from "./formatter.js";
|
|
5
5
|
export { compareLogLevel, isLogLevel, type LogLevel, parseLogLevel, } from "./level.js";
|
|
6
6
|
export { getLogger, type Logger } from "./logger.js";
|
|
7
7
|
export type { LogRecord } from "./record.js";
|
package/types/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,OAAO,EACP,WAAW,EACX,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,EACL,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,mBAAmB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EACL,KAAK,MAAM,EACX,KAAK,UAAU,EACf,cAAc,EACd,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,SAAS,EACd,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,eAAe,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,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