@logtape/logtape 2.2.0-dev.759 → 2.2.0-dev.760
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/context.cjs +13 -8
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +13 -8
- package/dist/context.js.map +1 -1
- package/dist/formatter.cjs +26 -25
- package/dist/formatter.d.cts.map +1 -1
- package/dist/formatter.d.ts.map +1 -1
- package/dist/formatter.js +26 -25
- package/dist/formatter.js.map +1 -1
- package/dist/logger.cjs +158 -20
- package/dist/logger.d.cts.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +159 -21
- package/dist/logger.js.map +1 -1
- package/dist/sink.cjs +6 -1
- package/dist/sink.d.cts.map +1 -1
- package/dist/sink.d.ts.map +1 -1
- package/dist/sink.js +6 -1
- package/dist/sink.js.map +1 -1
- package/package.json +1 -1
package/dist/context.cjs
CHANGED
|
@@ -42,17 +42,22 @@ function getCategoryPrefix() {
|
|
|
42
42
|
return Array.isArray(prefix) ? prefix : [];
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Gets the current implicit context
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* Gets the current implicit context only when user-visible context keys exist.
|
|
46
|
+
*
|
|
47
|
+
* This is intentionally not exported from the public entry point. Hot logging
|
|
48
|
+
* paths use it to avoid allocating a fresh `{}` when no implicit context is
|
|
49
|
+
* active, while `getImplicitContext()` keeps its public return contract.
|
|
50
|
+
* @returns The current implicit context without internal symbol keys, or
|
|
51
|
+
* `undefined` if there is no user-visible implicit context.
|
|
49
52
|
*/
|
|
50
|
-
function
|
|
53
|
+
function getImplicitContextIfAny() {
|
|
51
54
|
const rootLogger = require_logger.LoggerImpl.getLogger();
|
|
52
55
|
const store = rootLogger.contextLocalStorage?.getStore();
|
|
53
|
-
if (store == null) return
|
|
56
|
+
if (store == null) return void 0;
|
|
57
|
+
const keys = Object.keys(store);
|
|
58
|
+
if (keys.length < 1) return void 0;
|
|
54
59
|
const result = {};
|
|
55
|
-
for (const key of
|
|
60
|
+
for (const key of keys) result[key] = store[key];
|
|
56
61
|
return result;
|
|
57
62
|
}
|
|
58
63
|
/**
|
|
@@ -102,6 +107,6 @@ function withCategoryPrefix(prefix, callback) {
|
|
|
102
107
|
|
|
103
108
|
//#endregion
|
|
104
109
|
exports.getCategoryPrefix = getCategoryPrefix;
|
|
105
|
-
exports.
|
|
110
|
+
exports.getImplicitContextIfAny = getImplicitContextIfAny;
|
|
106
111
|
exports.withCategoryPrefix = withCategoryPrefix;
|
|
107
112
|
exports.withContext = withContext;
|
package/dist/context.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.cts","names":[],"sources":["../src/context.ts"],"sourcesContent":[],"mappings":";;AAeA;;;;;AAcc,UAdG,mBAcH,CAAA,CAAA,CAAA,CAAA;EAAC;AAef;;;;;EAGI,GAAA,CAAA,CAAA,CAAA,CAAA,KAAA,EAzBY,CAyBZ,EAAA,QAAA,EAAA,GAAA,GAzB+B,CAyB/B,CAAA,EAzBmC,CAyBnC;
|
|
1
|
+
{"version":3,"file":"context.d.cts","names":[],"sources":["../src/context.ts"],"sourcesContent":[],"mappings":";;AAeA;;;;;AAcc,UAdG,mBAcH,CAAA,CAAA,CAAA,CAAA;EAAC;AAef;;;;;EAGI,GAAA,CAAA,CAAA,CAAA,CAAA,KAAA,EAzBY,CAyBZ,EAAA,QAAA,EAAA,GAAA,GAzB+B,CAyB/B,CAAA,EAzBmC,CAyBnC;EAgGY;;;;AAGZ;cArHU;;;;;;;;;;;;;;iBAeE,wBACL,yCACO,IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgGa,0EAEE,IACf"}
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","names":[],"sources":["../src/context.ts"],"sourcesContent":[],"mappings":";;AAeA;;;;;AAcc,UAdG,mBAcH,CAAA,CAAA,CAAA,CAAA;EAAC;AAef;;;;;EAGI,GAAA,CAAA,CAAA,CAAA,CAAA,KAAA,EAzBY,CAyBZ,EAAA,QAAA,EAAA,GAAA,GAzB+B,CAyB/B,CAAA,EAzBmC,CAyBnC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","names":[],"sources":["../src/context.ts"],"sourcesContent":[],"mappings":";;AAeA;;;;;AAcc,UAdG,mBAcH,CAAA,CAAA,CAAA,CAAA;EAAC;AAef;;;;;EAGI,GAAA,CAAA,CAAA,CAAA,CAAA,KAAA,EAzBY,CAyBZ,EAAA,QAAA,EAAA,GAAA,GAzB+B,CAyB/B,CAAA,EAzBmC,CAyBnC;EAgGY;;;;AAGZ;cArHU;;;;;;;;;;;;;;iBAeE,wBACL,yCACO,IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgGa,0EAEE,IACf"}
|
package/dist/context.js
CHANGED
|
@@ -42,17 +42,22 @@ function getCategoryPrefix() {
|
|
|
42
42
|
return Array.isArray(prefix) ? prefix : [];
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Gets the current implicit context
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* Gets the current implicit context only when user-visible context keys exist.
|
|
46
|
+
*
|
|
47
|
+
* This is intentionally not exported from the public entry point. Hot logging
|
|
48
|
+
* paths use it to avoid allocating a fresh `{}` when no implicit context is
|
|
49
|
+
* active, while `getImplicitContext()` keeps its public return contract.
|
|
50
|
+
* @returns The current implicit context without internal symbol keys, or
|
|
51
|
+
* `undefined` if there is no user-visible implicit context.
|
|
49
52
|
*/
|
|
50
|
-
function
|
|
53
|
+
function getImplicitContextIfAny() {
|
|
51
54
|
const rootLogger = LoggerImpl.getLogger();
|
|
52
55
|
const store = rootLogger.contextLocalStorage?.getStore();
|
|
53
|
-
if (store == null) return
|
|
56
|
+
if (store == null) return void 0;
|
|
57
|
+
const keys = Object.keys(store);
|
|
58
|
+
if (keys.length < 1) return void 0;
|
|
54
59
|
const result = {};
|
|
55
|
-
for (const key of
|
|
60
|
+
for (const key of keys) result[key] = store[key];
|
|
56
61
|
return result;
|
|
57
62
|
}
|
|
58
63
|
/**
|
|
@@ -101,5 +106,5 @@ function withCategoryPrefix(prefix, callback) {
|
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
//#endregion
|
|
104
|
-
export { getCategoryPrefix,
|
|
109
|
+
export { getCategoryPrefix, getImplicitContextIfAny, withCategoryPrefix, withContext };
|
|
105
110
|
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":["categoryPrefixSymbol: unique symbol","context: Record<string, unknown>","callback: () => T","result: Record<string, unknown>","prefix: string | readonly string[]"],"sources":["../src/context.ts"],"sourcesContent":["import { LoggerImpl } from \"./logger.ts\";\n\n/**\n * Internal symbol for storing category prefix in context.\n */\nconst categoryPrefixSymbol: unique symbol = Symbol.for(\n \"logtape.categoryPrefix\",\n) as typeof categoryPrefixSymbol;\n\n/**\n * A generic interface for a context-local storage. It resembles\n * the {@link AsyncLocalStorage} API from Node.js.\n * @template T The type of the context-local store.\n * @since 0.7.0\n */\nexport interface ContextLocalStorage<T> {\n /**\n * Runs a callback with the given store as the context-local store.\n * @param store The store to use as the context-local store.\n * @param callback The callback to run.\n * @returns The return value of the callback.\n */\n run<R>(store: T, callback: () => R): R;\n\n /**\n * Returns the current context-local store.\n * @returns The current context-local store, or `undefined` if there is no\n * store.\n */\n getStore(): T | undefined;\n}\n\n/**\n * Runs a callback with the given implicit context. Every single log record\n * in the callback will have the given context.\n *\n * If no `contextLocalStorage` is configured, this function does nothing and\n * just returns the return value of the callback. It also logs a warning to\n * the `[\"logtape\", \"meta\"]` logger in this case.\n * @param context The context to inject.\n * @param callback The callback to run.\n * @returns The return value of the callback.\n * @since 0.7.0\n */\nexport function withContext<T>(\n context: Record<string, unknown>,\n callback: () => T,\n): T {\n const rootLogger = LoggerImpl.getLogger();\n if (rootLogger.contextLocalStorage == null) {\n LoggerImpl.getLogger([\"logtape\", \"meta\"]).warn(\n \"Context-local storage is not configured. \" +\n \"Specify contextLocalStorage option in the configure() function.\",\n );\n return callback();\n }\n const parentContext = rootLogger.contextLocalStorage.getStore() ?? {};\n return rootLogger.contextLocalStorage.run(\n { ...parentContext, ...context },\n callback,\n );\n}\n\n/**\n * Gets the current category prefix from context local storage.\n * @returns The current category prefix, or an empty array if not set.\n * @since 1.3.0\n */\nexport function getCategoryPrefix(): readonly string[] {\n const rootLogger = LoggerImpl.getLogger();\n const store = rootLogger.contextLocalStorage?.getStore();\n if (store == null) return [];\n const prefix = store[categoryPrefixSymbol as unknown as string];\n return Array.isArray(prefix) ? prefix : [];\n}\n\n/**\n * Gets the current implicit context from context local storage, excluding\n * internal symbol keys (like category prefix).\n * @returns The current implicit context without internal symbol keys.\n * @since 1.3.0\n */\nexport function getImplicitContext(): Record<string, unknown> {\n const rootLogger = LoggerImpl.getLogger();\n const store = rootLogger.contextLocalStorage?.getStore();\n if (store == null) return
|
|
1
|
+
{"version":3,"file":"context.js","names":["categoryPrefixSymbol: unique symbol","context: Record<string, unknown>","callback: () => T","result: Record<string, unknown>","prefix: string | readonly string[]"],"sources":["../src/context.ts"],"sourcesContent":["import { LoggerImpl } from \"./logger.ts\";\n\n/**\n * Internal symbol for storing category prefix in context.\n */\nconst categoryPrefixSymbol: unique symbol = Symbol.for(\n \"logtape.categoryPrefix\",\n) as typeof categoryPrefixSymbol;\n\n/**\n * A generic interface for a context-local storage. It resembles\n * the {@link AsyncLocalStorage} API from Node.js.\n * @template T The type of the context-local store.\n * @since 0.7.0\n */\nexport interface ContextLocalStorage<T> {\n /**\n * Runs a callback with the given store as the context-local store.\n * @param store The store to use as the context-local store.\n * @param callback The callback to run.\n * @returns The return value of the callback.\n */\n run<R>(store: T, callback: () => R): R;\n\n /**\n * Returns the current context-local store.\n * @returns The current context-local store, or `undefined` if there is no\n * store.\n */\n getStore(): T | undefined;\n}\n\n/**\n * Runs a callback with the given implicit context. Every single log record\n * in the callback will have the given context.\n *\n * If no `contextLocalStorage` is configured, this function does nothing and\n * just returns the return value of the callback. It also logs a warning to\n * the `[\"logtape\", \"meta\"]` logger in this case.\n * @param context The context to inject.\n * @param callback The callback to run.\n * @returns The return value of the callback.\n * @since 0.7.0\n */\nexport function withContext<T>(\n context: Record<string, unknown>,\n callback: () => T,\n): T {\n const rootLogger = LoggerImpl.getLogger();\n if (rootLogger.contextLocalStorage == null) {\n LoggerImpl.getLogger([\"logtape\", \"meta\"]).warn(\n \"Context-local storage is not configured. \" +\n \"Specify contextLocalStorage option in the configure() function.\",\n );\n return callback();\n }\n const parentContext = rootLogger.contextLocalStorage.getStore() ?? {};\n return rootLogger.contextLocalStorage.run(\n { ...parentContext, ...context },\n callback,\n );\n}\n\n/**\n * Gets the current category prefix from context local storage.\n * @returns The current category prefix, or an empty array if not set.\n * @since 1.3.0\n */\nexport function getCategoryPrefix(): readonly string[] {\n const rootLogger = LoggerImpl.getLogger();\n const store = rootLogger.contextLocalStorage?.getStore();\n if (store == null) return [];\n const prefix = store[categoryPrefixSymbol as unknown as string];\n return Array.isArray(prefix) ? prefix : [];\n}\n\n/**\n * Gets the current implicit context from context local storage, excluding\n * internal symbol keys (like category prefix).\n * @returns The current implicit context without internal symbol keys.\n * @since 1.3.0\n */\nexport function getImplicitContext(): Record<string, unknown> {\n return getImplicitContextIfAny() ?? {};\n}\n\n/**\n * Gets the current implicit context only when user-visible context keys exist.\n *\n * This is intentionally not exported from the public entry point. Hot logging\n * paths use it to avoid allocating a fresh `{}` when no implicit context is\n * active, while `getImplicitContext()` keeps its public return contract.\n * @returns The current implicit context without internal symbol keys, or\n * `undefined` if there is no user-visible implicit context.\n */\nexport function getImplicitContextIfAny():\n | Record<string, unknown>\n | undefined {\n const rootLogger = LoggerImpl.getLogger();\n const store = rootLogger.contextLocalStorage?.getStore();\n if (store == null) return undefined;\n\n const keys = Object.keys(store);\n if (keys.length < 1) return undefined;\n\n // Filter out symbol keys (like categoryPrefixSymbol).\n const result: Record<string, unknown> = {};\n for (const key of keys) {\n result[key] = store[key];\n }\n return result;\n}\n\n/**\n * Runs a callback with the given category prefix prepended to all log\n * categories within the callback context.\n *\n * This is useful for SDKs or libraries that want to add their own category\n * as a prefix to logs from their internal dependencies.\n *\n * If no `contextLocalStorage` is configured, this function does nothing and\n * just returns the return value of the callback. It also logs a warning to\n * the `[\"logtape\", \"meta\"]` logger in this case.\n *\n * @example Basic usage\n * ```typescript\n * import { getLogger, withCategoryPrefix } from \"@logtape/logtape\";\n *\n * export function sdkFunction() {\n * return withCategoryPrefix([\"my-sdk\"], () => {\n * // Any logs from internal libraries within this context\n * // will have [\"my-sdk\"] prepended to their category\n * return internalLibraryFunction();\n * });\n * }\n * ```\n *\n * @param prefix The category prefix to prepend. Can be a string or an array\n * of strings.\n * @param callback The callback to run.\n * @returns The return value of the callback.\n * @since 1.3.0\n */\nexport function withCategoryPrefix<T>(\n prefix: string | readonly string[],\n callback: () => T,\n): T {\n const rootLogger = LoggerImpl.getLogger();\n if (rootLogger.contextLocalStorage == null) {\n LoggerImpl.getLogger([\"logtape\", \"meta\"]).warn(\n \"Context-local storage is not configured. \" +\n \"Specify contextLocalStorage option in the configure() function.\",\n );\n return callback();\n }\n const parentContext = rootLogger.contextLocalStorage.getStore() ?? {};\n const parentPrefix = getCategoryPrefix();\n const newPrefix = typeof prefix === \"string\" ? [prefix] : [...prefix];\n return rootLogger.contextLocalStorage.run(\n {\n ...parentContext,\n [categoryPrefixSymbol as unknown as string]: [\n ...parentPrefix,\n ...newPrefix,\n ],\n },\n callback,\n );\n}\n"],"mappings":";;;;;;AAKA,MAAMA,uBAAsC,OAAO,IACjD,yBACD;;;;;;;;;;;;;AAqCD,SAAgB,YACdC,SACAC,UACG;CACH,MAAM,aAAa,WAAW,WAAW;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ter.cjs
CHANGED
|
@@ -245,6 +245,31 @@ function jsonReplacer(_key, value) {
|
|
|
245
245
|
for (const key of Object.keys(value)) if (!(key in serialized)) serialized[key] = value[key];
|
|
246
246
|
return serialized;
|
|
247
247
|
}
|
|
248
|
+
function renderDefaultJsonLinesMessage(message) {
|
|
249
|
+
const messageLength = message.length;
|
|
250
|
+
if (messageLength === 1) return message[0];
|
|
251
|
+
if (messageLength === 3) return message[0] + JSON.stringify(message[1]) + message[2];
|
|
252
|
+
let rendered = message[0];
|
|
253
|
+
for (let i = 1; i < messageLength; i++) rendered += i & 1 ? JSON.stringify(message[i]) : message[i];
|
|
254
|
+
return rendered;
|
|
255
|
+
}
|
|
256
|
+
function stringifyJsonLinesField(key, value) {
|
|
257
|
+
if (value != null && (typeof value === "object" || typeof value === "function" || typeof value === "bigint")) {
|
|
258
|
+
const toJSON = value.toJSON;
|
|
259
|
+
if (typeof toJSON === "function") value = toJSON.call(value, key);
|
|
260
|
+
}
|
|
261
|
+
return JSON.stringify(jsonReplacer(key, value), jsonReplacer);
|
|
262
|
+
}
|
|
263
|
+
function formatDefaultJsonLinesRecord(record, lineEnding) {
|
|
264
|
+
const level = record.level === "warning" ? "WARN" : record.level.toUpperCase();
|
|
265
|
+
const messageJson = stringifyJsonLinesField("message", renderDefaultJsonLinesMessage(record.message));
|
|
266
|
+
const propertiesJson = stringifyJsonLinesField("properties", record.properties);
|
|
267
|
+
let line = `{"@timestamp":${JSON.stringify(new Date(record.timestamp).toISOString())},"level":${JSON.stringify(level)}`;
|
|
268
|
+
if (messageJson !== void 0) line += `,"message":${messageJson}`;
|
|
269
|
+
line += `,"logger":${JSON.stringify(record.category.join("."))}`;
|
|
270
|
+
if (propertiesJson !== void 0) line += `,"properties":${propertiesJson}`;
|
|
271
|
+
return `${line}}${lineEnding}`;
|
|
272
|
+
}
|
|
248
273
|
/**
|
|
249
274
|
* Get a text formatter with the specified options. Although it's flexible
|
|
250
275
|
* enough to create a custom formatter, if you want more control, you can
|
|
@@ -404,31 +429,7 @@ const ansiColorFormatter = getAnsiColorFormatter();
|
|
|
404
429
|
*/
|
|
405
430
|
function getJsonLinesFormatter(options = {}) {
|
|
406
431
|
const lineEnding = getLineEndingValue(options.lineEnding);
|
|
407
|
-
if (!options.categorySeparator && !options.message && !options.properties) return (record) =>
|
|
408
|
-
if (record.message.length === 3) return JSON.stringify({
|
|
409
|
-
"@timestamp": new Date(record.timestamp).toISOString(),
|
|
410
|
-
level: record.level === "warning" ? "WARN" : record.level.toUpperCase(),
|
|
411
|
-
message: record.message[0] + JSON.stringify(record.message[1]) + record.message[2],
|
|
412
|
-
logger: record.category.join("."),
|
|
413
|
-
properties: record.properties
|
|
414
|
-
}, jsonReplacer) + lineEnding;
|
|
415
|
-
if (record.message.length === 1) return JSON.stringify({
|
|
416
|
-
"@timestamp": new Date(record.timestamp).toISOString(),
|
|
417
|
-
level: record.level === "warning" ? "WARN" : record.level.toUpperCase(),
|
|
418
|
-
message: record.message[0],
|
|
419
|
-
logger: record.category.join("."),
|
|
420
|
-
properties: record.properties
|
|
421
|
-
}, jsonReplacer) + lineEnding;
|
|
422
|
-
let msg = record.message[0];
|
|
423
|
-
for (let i = 1; i < record.message.length; i++) msg += i & 1 ? JSON.stringify(record.message[i]) : record.message[i];
|
|
424
|
-
return JSON.stringify({
|
|
425
|
-
"@timestamp": new Date(record.timestamp).toISOString(),
|
|
426
|
-
level: record.level === "warning" ? "WARN" : record.level.toUpperCase(),
|
|
427
|
-
message: msg,
|
|
428
|
-
logger: record.category.join("."),
|
|
429
|
-
properties: record.properties
|
|
430
|
-
}, jsonReplacer) + lineEnding;
|
|
431
|
-
};
|
|
432
|
+
if (!options.categorySeparator && !options.message && !options.properties) return (record) => formatDefaultJsonLinesRecord(record, lineEnding);
|
|
432
433
|
const isTemplateMessage = options.message === "template";
|
|
433
434
|
const propertiesOption = options.properties ?? "nest:properties";
|
|
434
435
|
let joinCategory;
|
package/dist/formatter.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.cts","names":[],"sources":["../src/formatter.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWA;AAsGA;AA+BA;;;AA6IoB,KAlRR,aAAA,GAkRQ,CAAA,MAAA,EAlRiB,SAkRjB,EAAA,GAAA,MAAA;AAAe;
|
|
1
|
+
{"version":3,"file":"formatter.d.cts","names":[],"sources":["../src/formatter.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWA;AAsGA;AA+BA;;;AA6IoB,KAlRR,aAAA,GAkRQ,CAAA,MAAA,EAlRiB,SAkRjB,EAAA,GAAA,MAAA;AAAe;AAoYnC;;;AAEG,UAljBc,eAAA,CAkjBd;EAAa;AA0FhB;AAQA;EAyBY,SAAA,EAAA,MAAS,GAAA,IAAA;EA4BJ;;;EA0CW,KAKT,EAAA,MAAA;EAAS;;;EAiBc,QAA1B,EAAA,MAAA;EAAM;;;EAhEiD,OAAA,EAAA,MAAA;EAqFvD;;;EACyB,MACtC,EAxwBO,SAwwBP;AAAa;AAgEhB;AAMA;AAiEA;;AACW,UAz4BM,oBAAA,CAy4BN;EAA8B;AACzB;AAqHhB;AAMA;AAoNA;;;;AAEgB;AA6EhB;AAUA;AAqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mEA7vCe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAmEK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoYJ,gBAAA,WACL,uBACR;;;;;;;;;;;cA0FU,sBAAsB;;;;;KAQvB,SAAA;;;;;KAyBA,SAAA;;;;;UA4BK,yBAAA,SAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA0ChC;;;;mBAKA;;;;eAKJ;;;;;;;;;;;gBAYC,OAAO,UAAU;;;;kBAKf;;;;kBAKA;;;;;;;;;;iBAWF,qBAAA,WACL,4BACR;;;;;;;;;;cAgEU,oBAAoB;;;;;UAMhB,yBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiED,qBAAA,WACL,4BACR;;;;;;;;;;;;;;;;;cAqHU,oBAAoB;;;;;UAMhB,sBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoND,kBAAA,WACL,yBACR;;;;;;;;cA6EU,iBAAiB;;;;;;;;;KAUlB,gBAAA,YAA4B;;;;;;;;iBAqBxB,uBAAA,SAAgC"}
|
package/dist/formatter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","names":[],"sources":["../src/formatter.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWA;AAsGA;AA+BA;;;AA6IoB,KAlRR,aAAA,GAkRQ,CAAA,MAAA,EAlRiB,SAkRjB,EAAA,GAAA,MAAA;AAAe;
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","names":[],"sources":["../src/formatter.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWA;AAsGA;AA+BA;;;AA6IoB,KAlRR,aAAA,GAkRQ,CAAA,MAAA,EAlRiB,SAkRjB,EAAA,GAAA,MAAA;AAAe;AAoYnC;;;AAEG,UAljBc,eAAA,CAkjBd;EAAa;AA0FhB;AAQA;EAyBY,SAAA,EAAA,MAAS,GAAA,IAAA;EA4BJ;;;EA0CW,KAKT,EAAA,MAAA;EAAS;;;EAiBc,QAA1B,EAAA,MAAA;EAAM;;;EAhEiD,OAAA,EAAA,MAAA;EAqFvD;;;EACyB,MACtC,EAxwBO,SAwwBP;AAAa;AAgEhB;AAMA;AAiEA;;AACW,UAz4BM,oBAAA,CAy4BN;EAA8B;AACzB;AAqHhB;AAMA;AAoNA;;;;AAEgB;AA6EhB;AAUA;AAqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mEA7vCe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAmEK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoYJ,gBAAA,WACL,uBACR;;;;;;;;;;;cA0FU,sBAAsB;;;;;KAQvB,SAAA;;;;;KAyBA,SAAA;;;;;UA4BK,yBAAA,SAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA0ChC;;;;mBAKA;;;;eAKJ;;;;;;;;;;;gBAYC,OAAO,UAAU;;;;kBAKf;;;;kBAKA;;;;;;;;;;iBAWF,qBAAA,WACL,4BACR;;;;;;;;;;cAgEU,oBAAoB;;;;;UAMhB,yBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiED,qBAAA,WACL,4BACR;;;;;;;;;;;;;;;;;cAqHU,oBAAoB;;;;;UAMhB,sBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoND,kBAAA,WACL,yBACR;;;;;;;;cA6EU,iBAAiB;;;;;;;;;KAUlB,gBAAA,YAA4B;;;;;;;;iBAqBxB,uBAAA,SAAgC"}
|
package/dist/formatter.js
CHANGED
|
@@ -244,6 +244,31 @@ function jsonReplacer(_key, value) {
|
|
|
244
244
|
for (const key of Object.keys(value)) if (!(key in serialized)) serialized[key] = value[key];
|
|
245
245
|
return serialized;
|
|
246
246
|
}
|
|
247
|
+
function renderDefaultJsonLinesMessage(message) {
|
|
248
|
+
const messageLength = message.length;
|
|
249
|
+
if (messageLength === 1) return message[0];
|
|
250
|
+
if (messageLength === 3) return message[0] + JSON.stringify(message[1]) + message[2];
|
|
251
|
+
let rendered = message[0];
|
|
252
|
+
for (let i = 1; i < messageLength; i++) rendered += i & 1 ? JSON.stringify(message[i]) : message[i];
|
|
253
|
+
return rendered;
|
|
254
|
+
}
|
|
255
|
+
function stringifyJsonLinesField(key, value) {
|
|
256
|
+
if (value != null && (typeof value === "object" || typeof value === "function" || typeof value === "bigint")) {
|
|
257
|
+
const toJSON = value.toJSON;
|
|
258
|
+
if (typeof toJSON === "function") value = toJSON.call(value, key);
|
|
259
|
+
}
|
|
260
|
+
return JSON.stringify(jsonReplacer(key, value), jsonReplacer);
|
|
261
|
+
}
|
|
262
|
+
function formatDefaultJsonLinesRecord(record, lineEnding) {
|
|
263
|
+
const level = record.level === "warning" ? "WARN" : record.level.toUpperCase();
|
|
264
|
+
const messageJson = stringifyJsonLinesField("message", renderDefaultJsonLinesMessage(record.message));
|
|
265
|
+
const propertiesJson = stringifyJsonLinesField("properties", record.properties);
|
|
266
|
+
let line = `{"@timestamp":${JSON.stringify(new Date(record.timestamp).toISOString())},"level":${JSON.stringify(level)}`;
|
|
267
|
+
if (messageJson !== void 0) line += `,"message":${messageJson}`;
|
|
268
|
+
line += `,"logger":${JSON.stringify(record.category.join("."))}`;
|
|
269
|
+
if (propertiesJson !== void 0) line += `,"properties":${propertiesJson}`;
|
|
270
|
+
return `${line}}${lineEnding}`;
|
|
271
|
+
}
|
|
247
272
|
/**
|
|
248
273
|
* Get a text formatter with the specified options. Although it's flexible
|
|
249
274
|
* enough to create a custom formatter, if you want more control, you can
|
|
@@ -403,31 +428,7 @@ const ansiColorFormatter = getAnsiColorFormatter();
|
|
|
403
428
|
*/
|
|
404
429
|
function getJsonLinesFormatter(options = {}) {
|
|
405
430
|
const lineEnding = getLineEndingValue(options.lineEnding);
|
|
406
|
-
if (!options.categorySeparator && !options.message && !options.properties) return (record) =>
|
|
407
|
-
if (record.message.length === 3) return JSON.stringify({
|
|
408
|
-
"@timestamp": new Date(record.timestamp).toISOString(),
|
|
409
|
-
level: record.level === "warning" ? "WARN" : record.level.toUpperCase(),
|
|
410
|
-
message: record.message[0] + JSON.stringify(record.message[1]) + record.message[2],
|
|
411
|
-
logger: record.category.join("."),
|
|
412
|
-
properties: record.properties
|
|
413
|
-
}, jsonReplacer) + lineEnding;
|
|
414
|
-
if (record.message.length === 1) return JSON.stringify({
|
|
415
|
-
"@timestamp": new Date(record.timestamp).toISOString(),
|
|
416
|
-
level: record.level === "warning" ? "WARN" : record.level.toUpperCase(),
|
|
417
|
-
message: record.message[0],
|
|
418
|
-
logger: record.category.join("."),
|
|
419
|
-
properties: record.properties
|
|
420
|
-
}, jsonReplacer) + lineEnding;
|
|
421
|
-
let msg = record.message[0];
|
|
422
|
-
for (let i = 1; i < record.message.length; i++) msg += i & 1 ? JSON.stringify(record.message[i]) : record.message[i];
|
|
423
|
-
return JSON.stringify({
|
|
424
|
-
"@timestamp": new Date(record.timestamp).toISOString(),
|
|
425
|
-
level: record.level === "warning" ? "WARN" : record.level.toUpperCase(),
|
|
426
|
-
message: msg,
|
|
427
|
-
logger: record.category.join("."),
|
|
428
|
-
properties: record.properties
|
|
429
|
-
}, jsonReplacer) + lineEnding;
|
|
430
|
-
};
|
|
431
|
+
if (!options.categorySeparator && !options.message && !options.properties) return (record) => formatDefaultJsonLinesRecord(record, lineEnding);
|
|
431
432
|
const isTemplateMessage = options.message === "template";
|
|
432
433
|
const propertiesOption = options.properties ?? "nest:properties";
|
|
433
434
|
let joinCategory;
|
package/dist/formatter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","names":["levelAbbreviations: Record<LogLevel, string>","platformInspect: (\n value: unknown,\n options?: { colors?: boolean },\n) => string | undefined","inspect: (value: unknown, options?: { colors?: boolean }) => string","value: unknown","options?: { colors?: boolean }","msgParts: readonly unknown[]","valueRenderer: (value: unknown) => string","msgLen: number","message: string","parts: string[]","num: number","minutes: number","full: boolean","formatter: Intl.DateTimeFormat","ts: number","config: TimeZoneConfig","timeZone: string | null | undefined","pattern: TimestampPattern","timeZone: TimeZoneConfig","lineEnding?: \"lf\" | \"crlf\"","_key: string","serialized: Record<string, unknown>","options: TextFormatterOptions","v: unknown","level: LogLevel","formatter: (values: FormattedValues) => string","record: LogRecord","values: FormattedValues","defaultTextFormatter: TextFormatter","ansiColors: Record<AnsiColor, string>","ansiStyles: Record<AnsiStyle, string>","defaultLevelColors: Record<LogLevel, AnsiColor | null>","options: AnsiColorFormatterOptions","ansiColorFormatter: TextFormatter","options: JsonLinesFormatterOptions","joinCategory: (category: readonly string[]) => string | readonly string[]","category: readonly string[]","getProperties: (\n properties: Record<string, unknown>,\n ) => Record<string, unknown>","result: Record<string, unknown>","getMessage: (record: LogRecord) => string","jsonLinesFormatter: TextFormatter","template: boolean","key: string","needsEscape: boolean","code: number","result: string","char: string","json: string | undefined","json: string","value: string","isString: boolean","needsQuote: boolean","quoted: string","pairs: string[]","options: LogfmtFormatterOptions","prependPrefix: string","lineEnding: string","timestampRenderer: (ts: number) => string | null","isTemplateMessage: boolean","propertiesOption: \"flatten\" | `prepend:${string}`","joinCategory: (category: readonly string[]) => string","propertyPrefix: string","logfmtFormatter: TextFormatter","logLevelStyles: Record<LogLevel, string>","values: unknown[]"],"sources":["../src/formatter.ts"],"sourcesContent":["import * as util from \"#util\";\nimport type { LogLevel } from \"./level.ts\";\nimport type { LogRecord } from \"./record.ts\";\n\n/**\n * A text formatter is a function that accepts a log record and returns\n * a string.\n *\n * @param record The log record to format.\n * @returns The formatted log record.\n */\nexport type TextFormatter = (record: LogRecord) => string;\n\n/**\n * The severity level abbreviations.\n */\nconst levelAbbreviations: Record<LogLevel, string> = {\n \"trace\": \"TRC\",\n \"debug\": \"DBG\",\n \"info\": \"INF\",\n \"warning\": \"WRN\",\n \"error\": \"ERR\",\n \"fatal\": \"FTL\",\n};\n\n/**\n * A platform-specific inspect function. In Deno, this is {@link Deno.inspect},\n * and in Node.js/Bun it is `util.inspect()`. If neither is available, it\n * falls back to {@link JSON.stringify}.\n *\n * @param value The value to inspect.\n * @param options The options for inspecting the value.\n * If `colors` is `true`, the output will be ANSI-colored.\n * @returns The string representation of the value.\n */\nconst platformInspect: (\n value: unknown,\n options?: { colors?: boolean },\n) => string | undefined =\n // @ts-ignore: Browser detection\n // dnt-shim-ignore\n typeof document !== \"undefined\" ||\n // @ts-ignore: React Native detection\n // dnt-shim-ignore\n typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\"\n ? (v) => JSON.stringify(v)\n // @ts-ignore: Deno global\n // dnt-shim-ignore\n : \"Deno\" in globalThis && \"inspect\" in globalThis.Deno &&\n // @ts-ignore: Deno global\n // dnt-shim-ignore\n typeof globalThis.Deno.inspect === \"function\"\n ? (v, opts) =>\n // @ts-ignore: Deno global\n // dnt-shim-ignore\n globalThis.Deno.inspect(v, {\n strAbbreviateSize: Infinity,\n iterableLimit: Infinity,\n ...opts,\n })\n // @ts-ignore: Node.js global\n // dnt-shim-ignore\n : util != null && \"inspect\" in util && typeof util.inspect === \"function\"\n ? (v, opts) =>\n // @ts-ignore: Node.js global\n // dnt-shim-ignore\n util.inspect(v, {\n maxArrayLength: Infinity,\n maxStringLength: Infinity,\n ...opts,\n })\n : (v) => JSON.stringify(v);\n\nconst inspect: (value: unknown, options?: { colors?: boolean }) => string = (\n value: unknown,\n options?: { colors?: boolean },\n): string => String(platformInspect(value, options));\n\nconst utf8Encoder = new TextEncoder();\n\nfunction renderMessageParts(\n msgParts: readonly unknown[],\n valueRenderer: (value: unknown) => string,\n): string {\n const msgLen: number = msgParts.length;\n\n if (msgLen === 1) {\n return msgParts[0] as string;\n }\n\n if (msgLen <= 6) {\n let message: string = \"\";\n for (let i = 0; i < msgLen; i++) {\n message += (i % 2 === 0)\n ? msgParts[i] as string\n : valueRenderer(msgParts[i]);\n }\n return message;\n }\n\n const parts: string[] = new Array(msgLen);\n for (let i = 0; i < msgLen; i++) {\n parts[i] = (i % 2 === 0)\n ? msgParts[i] as string\n : valueRenderer(msgParts[i]);\n }\n return parts.join(\"\");\n}\n\n/**\n * The formatted values for a log record.\n * @since 0.6.0\n */\nexport interface FormattedValues {\n /**\n * The formatted timestamp.\n */\n timestamp: string | null;\n\n /**\n * The formatted log level.\n */\n level: string;\n\n /**\n * The formatted category.\n */\n category: string;\n\n /**\n * The formatted message.\n */\n message: string;\n\n /**\n * The unformatted log record.\n */\n record: LogRecord;\n}\n\n/**\n * The various options for the built-in text formatters.\n * @since 0.6.0\n */\nexport interface TextFormatterOptions {\n /**\n * The timestamp format. This can be one of the following:\n *\n * - `\"date-time-timezone\"`: The date and time with the full timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000 +00:00\"`).\n * - `\"date-time-tz\"`: The date and time with the short timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000 +00\"`).\n * - `\"date-time\"`: The date and time without the timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000\"`).\n * - `\"time-timezone\"`: The time with the full timezone offset but without\n * the date (e.g., `\"22:13:20.000 +00:00\"`).\n * - `\"time-tz\"`: The time with the short timezone offset but without the date\n * (e.g., `\"22:13:20.000 +00\"`).\n * - `\"time\"`: The time without the date or timezone offset\n * (e.g., `\"22:13:20.000\"`).\n * - `\"date\"`: The date without the time or timezone offset\n * (e.g., `\"2023-11-14\"`).\n * - `\"rfc3339\"`: The date and time in RFC 3339 format\n * (e.g., `\"2023-11-14T22:13:20.000Z\"`).\n * - `\"none\"` or `\"disabled\"`: No display\n *\n * Alternatively, this can be a function that accepts a timestamp and returns\n * a string.\n *\n * The default is `\"date-time-timezone\"`.\n */\n timestamp?:\n | \"date-time-timezone\"\n | \"date-time-tz\"\n | \"date-time\"\n | \"time-timezone\"\n | \"time-tz\"\n | \"time\"\n | \"date\"\n | \"rfc3339\"\n | \"none\"\n | \"disabled\"\n | ((ts: number) => string | null);\n\n /**\n * The timezone used for timestamp rendering.\n *\n * - `undefined` (default): UTC (preserves existing behavior)\n * - `null`: System local timezone\n * - IANA timezone name such as `\"America/Bogota\"` or `\"Asia/Seoul\"`\n * - Fixed UTC offset string such as `\"+09:00\"` or `\"-05:00\"`\n *\n * @since 2.1.0\n */\n timeZone?: string | null;\n\n /**\n * The log level format. This can be one of the following:\n *\n * - `\"ABBR\"`: The log level abbreviation in uppercase (e.g., `\"INF\"`).\n * - `\"FULL\"`: The full log level name in uppercase (e.g., `\"INFO\"`).\n * - `\"L\"`: The first letter of the log level in uppercase (e.g., `\"I\"`).\n * - `\"abbr\"`: The log level abbreviation in lowercase (e.g., `\"inf\"`).\n * - `\"full\"`: The full log level name in lowercase (e.g., `\"info\"`).\n * - `\"l\"`: The first letter of the log level in lowercase (e.g., `\"i\"`).\n *\n * Alternatively, this can be a function that accepts a log level and returns\n * a string.\n *\n * The default is `\"ABBR\"`.\n */\n level?:\n | \"ABBR\"\n | \"FULL\"\n | \"L\"\n | \"abbr\"\n | \"full\"\n | \"l\"\n | ((level: LogLevel) => string);\n\n /**\n * The separator between category names. For example, if the separator is\n * `\"·\"`, the category `[\"a\", \"b\", \"c\"]` will be formatted as `\"a·b·c\"`.\n * The default separator is `\"·\"`.\n *\n * If this is a function, it will be called with the category array and\n * should return a string, which will be used for rendering the category.\n */\n category?: string | ((category: readonly string[]) => string);\n\n /**\n * The format of the embedded values.\n *\n * A function that renders a value to a string. This function is used to\n * render the values in the log record. The default is a cross-runtime\n * `inspect()` function that uses [`util.inspect()`] in Node.js/Bun,\n * [`Deno.inspect()`] in Deno, or falls back to {@link JSON.stringify} in\n * browsers.\n *\n * The second parameter provides access to the default cross-runtime\n * `inspect()` function, allowing you to fall back to the default behavior\n * for certain values while customizing others. You can ignore this\n * parameter if you don't need the fallback functionality.\n *\n * [`util.inspect()`]: https://nodejs.org/api/util.html#utilinspectobject-options\n * [`Deno.inspect()`]: https://docs.deno.com/api/deno/~/Deno.inspect\n * @param value The value to render.\n * @param inspect The default cross-runtime inspect function that can be used\n * as a fallback. Accepts an optional `options` parameter\n * with a `colors` boolean field.\n * @returns The string representation of the value.\n * @example\n * ```typescript\n * getTextFormatter({\n * value(value, inspect) {\n * // Custom formatting for numbers\n * if (typeof value === 'number') {\n * return value.toFixed(2);\n * }\n * // Fall back to default for everything else\n * return inspect(value);\n * }\n * })\n * ```\n */\n value?: (\n value: unknown,\n inspect: (value: unknown, options?: { colors?: boolean }) => string,\n ) => string;\n\n /**\n * How those formatted parts are concatenated.\n *\n * A function that formats the log record. This function is called with the\n * formatted values and should return a string. Note that the formatted\n * *should not* include a newline character at the end.\n *\n * By default, this is a function that formats the log record as follows:\n *\n * ```\n * 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!\n * ```\n * @param values The formatted values.\n * @returns The formatted log record.\n */\n format?: (values: FormattedValues) => string;\n\n /**\n * Line ending style for formatted output.\n *\n * - `\"lf\"`: Unix-style line endings (`\\n`)\n * - `\"crlf\"`: Windows-style line endings (`\\r\\n`)\n *\n * @default \"lf\"\n * @since 2.0.0\n */\n lineEnding?: \"lf\" | \"crlf\";\n}\n\n// Optimized helper functions for timestamp formatting\nfunction padZero(num: number): string {\n return num < 10 ? `0${num}` : `${num}`;\n}\n\nfunction padThree(num: number): string {\n return num < 10 ? `00${num}` : num < 100 ? `0${num}` : `${num}`;\n}\n\ntype TimestampPattern =\n | \"date-time-timezone\"\n | \"date-time-tz\"\n | \"date-time\"\n | \"time-timezone\"\n | \"time-tz\"\n | \"time\"\n | \"date\"\n | \"rfc3339\"\n | \"none\";\n\ntype TimeZoneConfig =\n | { kind: \"utc\" }\n | { kind: \"local\" }\n | { kind: \"offset\"; minutes: number }\n | { kind: \"iana\"; formatter: Intl.DateTimeFormat };\n\ntype DateParts = {\n year: string;\n month: string;\n day: string;\n hour: string;\n minute: string;\n second: string;\n ms: string;\n offsetMinutes: number;\n};\n\nconst fixedOffsetPattern = /^([+-])(0\\d|1\\d|2[0-3]):([0-5]\\d)$/;\n\nfunction formatOffset(minutes: number, full: boolean): string {\n const sign = minutes < 0 ? \"-\" : \"+\";\n const absolute = Math.abs(minutes);\n const hour = padZero(Math.floor(absolute / 60));\n const minute = padZero(absolute % 60);\n if (!full && minute === \"00\") return `${sign}${hour}`;\n return `${sign}${hour}:${minute}`;\n}\n\nfunction readPartsFromFormatter(\n formatter: Intl.DateTimeFormat,\n ts: number,\n): Omit<DateParts, \"ms\" | \"offsetMinutes\"> {\n const parts = formatter.formatToParts(new Date(ts));\n let year = \"\";\n let month = \"\";\n let day = \"\";\n let hour = \"\";\n let minute = \"\";\n let second = \"\";\n for (const part of parts) {\n if (part.type === \"year\") year = part.value;\n else if (part.type === \"month\") month = part.value;\n else if (part.type === \"day\") day = part.value;\n else if (part.type === \"hour\") hour = part.value;\n else if (part.type === \"minute\") minute = part.value;\n else if (part.type === \"second\") second = part.value;\n }\n return { year, month, day, hour, minute, second };\n}\n\nfunction getDateParts(ts: number, config: TimeZoneConfig): DateParts {\n const d = new Date(ts);\n const ms = padThree(d.getUTCMilliseconds());\n\n if (config.kind === \"utc\") {\n return {\n year: `${d.getUTCFullYear()}`,\n month: padZero(d.getUTCMonth() + 1),\n day: padZero(d.getUTCDate()),\n hour: padZero(d.getUTCHours()),\n minute: padZero(d.getUTCMinutes()),\n second: padZero(d.getUTCSeconds()),\n ms,\n offsetMinutes: 0,\n };\n }\n\n if (config.kind === \"local\") {\n return {\n year: `${d.getFullYear()}`,\n month: padZero(d.getMonth() + 1),\n day: padZero(d.getDate()),\n hour: padZero(d.getHours()),\n minute: padZero(d.getMinutes()),\n second: padZero(d.getSeconds()),\n ms,\n offsetMinutes: -d.getTimezoneOffset(),\n };\n }\n\n if (config.kind === \"offset\") {\n const shifted = new Date(ts + config.minutes * 60_000);\n return {\n year: `${shifted.getUTCFullYear()}`,\n month: padZero(shifted.getUTCMonth() + 1),\n day: padZero(shifted.getUTCDate()),\n hour: padZero(shifted.getUTCHours()),\n minute: padZero(shifted.getUTCMinutes()),\n second: padZero(shifted.getUTCSeconds()),\n ms,\n offsetMinutes: config.minutes,\n };\n }\n\n const parts = readPartsFromFormatter(config.formatter, ts);\n const asUtc = Date.UTC(\n Number(parts.year),\n Number(parts.month) - 1,\n Number(parts.day),\n Number(parts.hour),\n Number(parts.minute),\n Number(parts.second),\n d.getUTCMilliseconds(),\n );\n const offsetMinutes = Math.round((asUtc - ts) / 60_000);\n return { ...parts, ms, offsetMinutes };\n}\n\nfunction resolveTimeZone(timeZone: string | null | undefined): TimeZoneConfig {\n if (typeof timeZone === \"undefined\") return { kind: \"utc\" };\n if (timeZone === null) return { kind: \"local\" };\n\n const offsetMatch = fixedOffsetPattern.exec(timeZone);\n if (offsetMatch != null) {\n const sign = offsetMatch[1] === \"-\" ? -1 : 1;\n const hours = Number(offsetMatch[2]);\n const minutes = Number(offsetMatch[3]);\n return { kind: \"offset\", minutes: sign * (hours * 60 + minutes) };\n }\n\n if (\n typeof Intl === \"undefined\" || typeof Intl.DateTimeFormat !== \"function\"\n ) {\n throw new TypeError(\n `Invalid timeZone option: ${\n JSON.stringify(timeZone)\n }. This environment does not support IANA time zones.`,\n );\n }\n\n try {\n return {\n kind: \"iana\",\n formatter: new Intl.DateTimeFormat(\"en-CA\", {\n timeZone,\n hour12: false,\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n }),\n };\n } catch {\n throw new TypeError(\n `Invalid timeZone option: ${\n JSON.stringify(timeZone)\n }. Expected an IANA time zone name (e.g., \"Asia/Seoul\") or a fixed UTC offset string (e.g., \"+09:00\").`,\n );\n }\n}\n\nfunction createTimestampFormatter(\n pattern: TimestampPattern,\n timeZone: TimeZoneConfig,\n): (ts: number) => string | null {\n if (pattern === \"none\") return () => null;\n if (pattern === \"rfc3339\" && timeZone.kind === \"utc\") {\n return (ts: number): string => new Date(ts).toISOString();\n }\n\n return (ts: number): string => {\n const parts = getDateParts(ts, timeZone);\n const date = `${parts.year}-${parts.month}-${parts.day}`;\n const time = `${parts.hour}:${parts.minute}:${parts.second}.${parts.ms}`;\n const tzLong = formatOffset(parts.offsetMinutes, true);\n const tzShort = formatOffset(parts.offsetMinutes, false);\n\n if (pattern === \"date-time-timezone\") return `${date} ${time} ${tzLong}`;\n if (pattern === \"date-time-tz\") return `${date} ${time} ${tzShort}`;\n if (pattern === \"date-time\") return `${date} ${time}`;\n if (pattern === \"time-timezone\") return `${time} ${tzLong}`;\n if (pattern === \"time-tz\") return `${time} ${tzShort}`;\n if (pattern === \"time\") return time;\n if (pattern === \"date\") return date;\n return `${date}T${time}${tzLong}`;\n };\n}\n\n// Pre-computed level renderers for common cases\nconst levelRenderersCache = {\n ABBR: levelAbbreviations,\n abbr: {\n trace: \"trc\",\n debug: \"dbg\",\n info: \"inf\",\n warning: \"wrn\",\n error: \"err\",\n fatal: \"ftl\",\n } as const,\n FULL: {\n trace: \"TRACE\",\n debug: \"DEBUG\",\n info: \"INFO\",\n warning: \"WARNING\",\n error: \"ERROR\",\n fatal: \"FATAL\",\n } as const,\n full: {\n trace: \"trace\",\n debug: \"debug\",\n info: \"info\",\n warning: \"warning\",\n error: \"error\",\n fatal: \"fatal\",\n } as const,\n L: {\n trace: \"T\",\n debug: \"D\",\n info: \"I\",\n warning: \"W\",\n error: \"E\",\n fatal: \"F\",\n } as const,\n l: {\n trace: \"t\",\n debug: \"d\",\n info: \"i\",\n warning: \"w\",\n error: \"e\",\n fatal: \"f\",\n } as const,\n} as const;\n\n/**\n * Helper function to get the line ending value based on the option.\n * @param lineEnding The line ending option.\n * @returns The line ending string.\n */\nfunction getLineEndingValue(lineEnding?: \"lf\" | \"crlf\"): string {\n return lineEnding === \"crlf\" ? \"\\r\\n\" : \"\\n\";\n}\n\nfunction jsonReplacer(_key: string, value: unknown): unknown {\n if (!(value instanceof Error)) return value;\n\n const serialized: Record<string, unknown> = {\n name: value.name,\n message: value.message,\n };\n\n if (typeof value.stack === \"string\") {\n serialized.stack = value.stack;\n }\n\n const cause = (value as { cause?: unknown }).cause;\n if (cause !== undefined) {\n serialized.cause = cause;\n }\n\n if (\n typeof AggregateError !== \"undefined\" &&\n value instanceof AggregateError\n ) {\n serialized.errors = value.errors;\n }\n\n for (const key of Object.keys(value)) {\n if (!(key in serialized)) {\n serialized[key] = (value as unknown as Record<string, unknown>)[key];\n }\n }\n\n return serialized;\n}\n\n/**\n * Get a text formatter with the specified options. Although it's flexible\n * enough to create a custom formatter, if you want more control, you can\n * create a custom formatter that satisfies the {@link TextFormatter} type\n * instead.\n *\n * For more information on the options, see {@link TextFormatterOptions}.\n *\n * By default, the formatter formats log records as follows:\n *\n * ```\n * 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!\n * ```\n * @param options The options for the text formatter.\n * @returns The text formatter.\n * @since 0.6.0\n */\nexport function getTextFormatter(\n options: TextFormatterOptions = {},\n): TextFormatter {\n // Pre-compute timestamp formatter with optimized lookup\n const timestampRenderer = (() => {\n const tsOption = options.timestamp;\n const timeZone = resolveTimeZone(options.timeZone);\n if (tsOption == null) {\n return createTimestampFormatter(\"date-time-timezone\", timeZone);\n } else if (tsOption === \"disabled\") {\n return createTimestampFormatter(\"none\", timeZone);\n } else if (\n typeof tsOption === \"string\" &&\n (\n tsOption === \"date-time-timezone\" ||\n tsOption === \"date-time-tz\" ||\n tsOption === \"date-time\" ||\n tsOption === \"time-timezone\" ||\n tsOption === \"time-tz\" ||\n tsOption === \"time\" ||\n tsOption === \"date\" ||\n tsOption === \"rfc3339\" ||\n tsOption === \"none\"\n )\n ) {\n return createTimestampFormatter(tsOption, timeZone);\n } else {\n return tsOption as (ts: number) => string | null;\n }\n })();\n\n const categorySeparator = options.category ?? \"·\";\n const valueRenderer = options.value\n ? (v: unknown) => options.value!(v, inspect)\n : inspect;\n\n // Pre-compute level renderer for better performance\n const levelRenderer = (() => {\n const levelOption = options.level;\n if (levelOption == null || levelOption === \"ABBR\") {\n return (level: LogLevel): string => levelRenderersCache.ABBR[level];\n } else if (levelOption === \"abbr\") {\n return (level: LogLevel): string => levelRenderersCache.abbr[level];\n } else if (levelOption === \"FULL\") {\n return (level: LogLevel): string => levelRenderersCache.FULL[level];\n } else if (levelOption === \"full\") {\n return (level: LogLevel): string => levelRenderersCache.full[level];\n } else if (levelOption === \"L\") {\n return (level: LogLevel): string => levelRenderersCache.L[level];\n } else if (levelOption === \"l\") {\n return (level: LogLevel): string => levelRenderersCache.l[level];\n } else {\n return levelOption;\n }\n })();\n\n const lineEnding = getLineEndingValue(options.lineEnding);\n\n const formatter: (values: FormattedValues) => string = options.format ??\n (({ timestamp, level, category, message }: FormattedValues) =>\n `${timestamp ? `${timestamp} ` : \"\"}[${level}] ${category}: ${message}`);\n\n return (record: LogRecord): string => {\n const message: string = renderMessageParts(record.message, valueRenderer);\n\n const timestamp = timestampRenderer(record.timestamp);\n const level = levelRenderer(record.level);\n const category = typeof categorySeparator === \"function\"\n ? categorySeparator(record.category)\n : record.category.join(categorySeparator);\n\n const values: FormattedValues = {\n timestamp,\n level,\n category,\n message,\n record,\n };\n return `${formatter(values)}${lineEnding}`;\n };\n}\n\n/**\n * The default text formatter. This formatter formats log records as follows:\n *\n * ```\n * 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!\n * ```\n *\n * @param record The log record to format.\n * @returns The formatted log record.\n */\nexport const defaultTextFormatter: TextFormatter = getTextFormatter();\n\nconst RESET = \"\\x1b[0m\";\n\n/**\n * The ANSI colors. These can be used to colorize text in the console.\n * @since 0.6.0\n */\nexport type AnsiColor =\n | \"black\"\n | \"red\"\n | \"green\"\n | \"yellow\"\n | \"blue\"\n | \"magenta\"\n | \"cyan\"\n | \"white\";\n\nconst ansiColors: Record<AnsiColor, string> = {\n black: \"\\x1b[30m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n white: \"\\x1b[37m\",\n};\n\n/**\n * The ANSI text styles.\n * @since 0.6.0\n */\nexport type AnsiStyle =\n | \"bold\"\n | \"dim\"\n | \"italic\"\n | \"underline\"\n | \"strikethrough\";\n\nconst ansiStyles: Record<AnsiStyle, string> = {\n bold: \"\\x1b[1m\",\n dim: \"\\x1b[2m\",\n italic: \"\\x1b[3m\",\n underline: \"\\x1b[4m\",\n strikethrough: \"\\x1b[9m\",\n};\n\nconst defaultLevelColors: Record<LogLevel, AnsiColor | null> = {\n trace: null,\n debug: \"blue\",\n info: \"green\",\n warning: \"yellow\",\n error: \"red\",\n fatal: \"magenta\",\n};\n\n/**\n * The various options for the ANSI color formatter.\n * @since 0.6.0\n */\nexport interface AnsiColorFormatterOptions extends TextFormatterOptions {\n /**\n * The timestamp format. This can be one of the following:\n *\n * - `\"date-time-timezone\"`: The date and time with the full timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000 +00:00\"`).\n * - `\"date-time-tz\"`: The date and time with the short timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000 +00\"`).\n * - `\"date-time\"`: The date and time without the timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000\"`).\n * - `\"time-timezone\"`: The time with the full timezone offset but without\n * the date (e.g., `\"22:13:20.000 +00:00\"`).\n * - `\"time-tz\"`: The time with the short timezone offset but without the date\n * (e.g., `\"22:13:20.000 +00\"`).\n * - `\"time\"`: The time without the date or timezone offset\n * (e.g., `\"22:13:20.000\"`).\n * - `\"date\"`: The date without the time or timezone offset\n * (e.g., `\"2023-11-14\"`).\n * - `\"rfc3339\"`: The date and time in RFC 3339 format\n * (e.g., `\"2023-11-14T22:13:20.000Z\"`).\n *\n * Alternatively, this can be a function that accepts a timestamp and returns\n * a string.\n *\n * The default is `\"date-time-tz\"`.\n */\n timestamp?:\n | \"date-time-timezone\"\n | \"date-time-tz\"\n | \"date-time\"\n | \"time-timezone\"\n | \"time-tz\"\n | \"time\"\n | \"date\"\n | \"rfc3339\"\n | \"none\"\n | \"disabled\"\n | ((ts: number) => string | null);\n\n /**\n * The ANSI style for the timestamp. `\"dim\"` is used by default.\n */\n timestampStyle?: AnsiStyle | null;\n\n /**\n * The ANSI color for the timestamp. No color is used by default.\n */\n timestampColor?: AnsiColor | null;\n\n /**\n * The ANSI style for the log level. `\"bold\"` is used by default.\n */\n levelStyle?: AnsiStyle | null;\n\n /**\n * The ANSI colors for the log levels. The default colors are as follows:\n *\n * - `\"trace\"`: `null` (no color)\n * - `\"debug\"`: `\"blue\"`\n * - `\"info\"`: `\"green\"`\n * - `\"warning\"`: `\"yellow\"`\n * - `\"error\"`: `\"red\"`\n * - `\"fatal\"`: `\"magenta\"`\n */\n levelColors?: Record<LogLevel, AnsiColor | null>;\n\n /**\n * The ANSI style for the category. `\"dim\"` is used by default.\n */\n categoryStyle?: AnsiStyle | null;\n\n /**\n * The ANSI color for the category. No color is used by default.\n */\n categoryColor?: AnsiColor | null;\n}\n\n/**\n * Get an ANSI color formatter with the specified options.\n *\n * \n * @param option The options for the ANSI color formatter.\n * @returns The ANSI color formatter.\n * @since 0.6.0\n */\nexport function getAnsiColorFormatter(\n options: AnsiColorFormatterOptions = {},\n): TextFormatter {\n const format = options.format;\n const timestampStyle = typeof options.timestampStyle === \"undefined\"\n ? \"dim\"\n : options.timestampStyle;\n const timestampColor = options.timestampColor ?? null;\n const timestampPrefix = `${\n timestampStyle == null ? \"\" : ansiStyles[timestampStyle]\n }${timestampColor == null ? \"\" : ansiColors[timestampColor]}`;\n const timestampSuffix = timestampStyle == null && timestampColor == null\n ? \"\"\n : RESET;\n const levelStyle = typeof options.levelStyle === \"undefined\"\n ? \"bold\"\n : options.levelStyle;\n const levelColors = options.levelColors ?? defaultLevelColors;\n const categoryStyle = typeof options.categoryStyle === \"undefined\"\n ? \"dim\"\n : options.categoryStyle;\n const categoryColor = options.categoryColor ?? null;\n const categoryPrefix = `${\n categoryStyle == null ? \"\" : ansiStyles[categoryStyle]\n }${categoryColor == null ? \"\" : ansiColors[categoryColor]}`;\n const categorySuffix = categoryStyle == null && categoryColor == null\n ? \"\"\n : RESET;\n return getTextFormatter({\n timestamp: \"date-time-tz\",\n value(value: unknown, fallbackInspect): string {\n return fallbackInspect(value, { colors: true });\n },\n ...options,\n format({ timestamp, level, category, message, record }): string {\n const levelColor = levelColors[record.level];\n timestamp = timestamp == null\n ? null\n : `${timestampPrefix}${timestamp}${timestampSuffix}`;\n level = `${levelStyle == null ? \"\" : ansiStyles[levelStyle]}${\n levelColor == null ? \"\" : ansiColors[levelColor]\n }${level}${levelStyle == null && levelColor == null ? \"\" : RESET}`;\n return format == null\n ? `${\n timestamp == null ? \"\" : `${timestamp} `\n }${level} ${categoryPrefix}${category}:${categorySuffix} ${message}`\n : format({\n timestamp,\n level,\n category: `${categoryPrefix}${category}${categorySuffix}`,\n message,\n record,\n });\n },\n });\n}\n\n/**\n * A text formatter that uses ANSI colors to format log records.\n *\n * \n *\n * @param record The log record to format.\n * @returns The formatted log record.\n * @since 0.5.0\n */\nexport const ansiColorFormatter: TextFormatter = getAnsiColorFormatter();\n\n/**\n * Options for the {@link getJsonLinesFormatter} function.\n * @since 0.11.0\n */\nexport interface JsonLinesFormatterOptions {\n /**\n * The separator between category names. For example, if the separator is\n * `\".\"`, the category `[\"a\", \"b\", \"c\"]` will be formatted as `\"a.b.c\"`.\n * If this is a function, it will be called with the category array and\n * should return a string or an array of strings, which will be used\n * for rendering the category.\n *\n * @default `\".\"`\n */\n readonly categorySeparator?:\n | string\n | ((category: readonly string[]) => string | readonly string[]);\n\n /**\n * The message format. This can be one of the following:\n *\n * - `\"template\"`: The raw message template is used as the message.\n * - `\"rendered\"`: The message is rendered with the values.\n *\n * @default `\"rendered\"`\n */\n readonly message?: \"template\" | \"rendered\";\n\n /**\n * The properties format. This can be one of the following:\n *\n * - `\"flatten\"`: The properties are flattened into the root object.\n * - `\"prepend:<prefix>\"`: The properties are prepended with the given prefix\n * (e.g., `\"prepend:ctx_\"` will prepend `ctx_` to each property key).\n * - `\"nest:<key>\"`: The properties are nested under the given key\n * (e.g., `\"nest:properties\"` will nest the properties under the\n * `properties` key).\n *\n * @default `\"nest:properties\"`\n */\n readonly properties?: \"flatten\" | `prepend:${string}` | `nest:${string}`;\n\n /**\n * Line ending style for formatted output.\n *\n * - `\"lf\"`: Unix-style line endings (`\\n`)\n * - `\"crlf\"`: Windows-style line endings (`\\r\\n`)\n *\n * @default \"lf\"\n * @since 2.0.0\n */\n readonly lineEnding?: \"lf\" | \"crlf\";\n}\n\n/**\n * Get a [JSON Lines] formatter with the specified options. The log records\n * will be rendered as JSON objects, one per line, which is a common format\n * for log files. This format is also known as Newline-Delimited JSON (NDJSON).\n * It looks like this:\n *\n * ```json\n * {\"@timestamp\":\"2023-11-14T22:13:20.000Z\",\"level\":\"INFO\",\"message\":\"Hello, world!\",\"logger\":\"my.logger\",\"properties\":{\"key\":\"value\"}}\n * ```\n *\n * [JSON Lines]: https://jsonlines.org/\n * @param options The options for the JSON Lines formatter.\n * @returns The JSON Lines formatter.\n * @since 0.11.0\n */\nexport function getJsonLinesFormatter(\n options: JsonLinesFormatterOptions = {},\n): TextFormatter {\n const lineEnding = getLineEndingValue(options.lineEnding);\n\n // Most common configuration - optimize for the default case\n if (!options.categorySeparator && !options.message && !options.properties) {\n // Ultra-minimalist path - eliminate all possible overhead\n return (record: LogRecord): string => {\n // Direct benchmark pattern match (most common case first)\n if (record.message.length === 3) {\n return JSON.stringify({\n \"@timestamp\": new Date(record.timestamp).toISOString(),\n level: record.level === \"warning\"\n ? \"WARN\"\n : record.level.toUpperCase(),\n message: record.message[0] + JSON.stringify(record.message[1]) +\n record.message[2],\n logger: record.category.join(\".\"),\n properties: record.properties,\n }, jsonReplacer) + lineEnding;\n }\n\n // Single message (second most common)\n if (record.message.length === 1) {\n return JSON.stringify({\n \"@timestamp\": new Date(record.timestamp).toISOString(),\n level: record.level === \"warning\"\n ? \"WARN\"\n : record.level.toUpperCase(),\n message: record.message[0],\n logger: record.category.join(\".\"),\n properties: record.properties,\n }, jsonReplacer) + lineEnding;\n }\n\n // Complex messages (fallback)\n let msg = record.message[0] as string;\n for (let i = 1; i < record.message.length; i++) {\n msg += (i & 1) ? JSON.stringify(record.message[i]) : record.message[i];\n }\n\n return JSON.stringify({\n \"@timestamp\": new Date(record.timestamp).toISOString(),\n level: record.level === \"warning\" ? \"WARN\" : record.level.toUpperCase(),\n message: msg,\n logger: record.category.join(\".\"),\n properties: record.properties,\n }, jsonReplacer) + lineEnding;\n };\n }\n\n // Pre-compile configuration for non-default cases\n const isTemplateMessage = options.message === \"template\";\n const propertiesOption = options.properties ?? \"nest:properties\";\n\n // Pre-compile category joining strategy\n let joinCategory: (category: readonly string[]) => string | readonly string[];\n if (typeof options.categorySeparator === \"function\") {\n joinCategory = options.categorySeparator;\n } else {\n const separator = options.categorySeparator ?? \".\";\n joinCategory = (category: readonly string[]): string =>\n category.join(separator);\n }\n\n // Pre-compile properties handling strategy\n let getProperties: (\n properties: Record<string, unknown>,\n ) => Record<string, unknown>;\n\n if (propertiesOption === \"flatten\") {\n getProperties = (properties) => properties;\n } else if (propertiesOption.startsWith(\"prepend:\")) {\n const prefix = propertiesOption.substring(8);\n if (prefix === \"\") {\n throw new TypeError(\n `Invalid properties option: ${\n JSON.stringify(propertiesOption)\n }. It must be of the form \"prepend:<prefix>\" where <prefix> is a non-empty string.`,\n );\n }\n getProperties = (properties) => {\n const result: Record<string, unknown> = {};\n for (const key in properties) {\n result[`${prefix}${key}`] = properties[key];\n }\n return result;\n };\n } else if (propertiesOption.startsWith(\"nest:\")) {\n const key = propertiesOption.substring(5);\n getProperties = (properties) => ({ [key]: properties });\n } else {\n throw new TypeError(\n `Invalid properties option: ${\n JSON.stringify(propertiesOption)\n }. It must be \"flatten\", \"prepend:<prefix>\", or \"nest:<key>\".`,\n );\n }\n\n // Pre-compile message rendering function\n let getMessage: (record: LogRecord) => string;\n\n if (isTemplateMessage) {\n getMessage = (record: LogRecord): string => {\n if (typeof record.rawMessage === \"string\") {\n return record.rawMessage;\n }\n let msg = \"\";\n for (let i = 0; i < record.rawMessage.length; i++) {\n if (i > 0) msg += \"{}\";\n msg += record.rawMessage[i];\n }\n return msg;\n };\n } else {\n getMessage = (record: LogRecord): string => {\n const msgLen = record.message.length;\n\n if (msgLen === 1) {\n return record.message[0] as string;\n }\n\n let msg = \"\";\n for (let i = 0; i < msgLen; i++) {\n msg += (i % 2 < 1)\n ? record.message[i]\n : JSON.stringify(record.message[i]);\n }\n return msg;\n };\n }\n\n return (record: LogRecord): string => {\n return JSON.stringify({\n \"@timestamp\": new Date(record.timestamp).toISOString(),\n level: record.level === \"warning\" ? \"WARN\" : record.level.toUpperCase(),\n message: getMessage(record),\n logger: joinCategory(record.category),\n ...getProperties(record.properties),\n }, jsonReplacer) + lineEnding;\n };\n}\n\n/**\n * The default [JSON Lines] formatter. This formatter formats log records\n * as JSON objects, one per line, which is a common format for log files.\n * It looks like this:\n *\n * ```json\n * {\"@timestamp\":\"2023-11-14T22:13:20.000Z\",\"level\":\"INFO\",\"message\":\"Hello, world!\",\"logger\":\"my.logger\",\"properties\":{\"key\":\"value\"}}\n * ```\n *\n * You can customize the output by passing options to\n * {@link getJsonLinesFormatter}. For example, you can change the category\n * separator, the message format, and how the properties are formatted.\n *\n * [JSON Lines]: https://jsonlines.org/\n * @since 0.11.0\n */\nexport const jsonLinesFormatter: TextFormatter = getJsonLinesFormatter();\n\n/**\n * Options for the {@link getLogfmtFormatter} function.\n * @since 2.1.0\n */\nexport interface LogfmtFormatterOptions {\n /**\n * The separator between category names. For example, if the separator is\n * `\".\"`, the category `[\"a\", \"b\", \"c\"]` will be formatted as `\"a.b.c\"`.\n * If this is a function, it will be called with the category array and\n * should return a string, which will be used for rendering the category.\n *\n * @default `\".\"`\n */\n readonly categorySeparator?:\n | string\n | ((category: readonly string[]) => string);\n\n /**\n * The message format. This can be one of the following:\n *\n * - `\"template\"`: The raw message template is used as the message.\n * - `\"rendered\"`: The message is rendered with the values.\n *\n * @default `\"rendered\"`\n */\n readonly message?: \"template\" | \"rendered\";\n\n /**\n * The properties format. This can be one of the following:\n *\n * - `\"flatten\"`: The properties are flattened into logfmt key-value pairs.\n * - `\"prepend:<prefix>\"`: The properties are prepended with the given prefix\n * (e.g., `\"prepend:ctx_\"` will prepend `ctx_` to each property key).\n *\n * @default `\"flatten\"`\n */\n readonly properties?: \"flatten\" | `prepend:${string}`;\n\n /**\n * The timezone used for timestamp rendering.\n *\n * - `undefined` (default): UTC\n * - `null`: System local timezone\n * - IANA timezone name such as `\"America/Bogota\"` or `\"Asia/Seoul\"`\n * - Fixed UTC offset string such as `\"+09:00\"` or `\"-05:00\"`\n *\n * @since 2.1.0\n */\n readonly timeZone?: string | null;\n\n /**\n * Line ending style for formatted output.\n *\n * - `\"lf\"`: Unix-style line endings (`\\n`)\n * - `\"crlf\"`: Windows-style line endings (`\\r\\n`)\n *\n * @default \"lf\"\n * @since 2.1.0\n */\n readonly lineEnding?: \"lf\" | \"crlf\";\n}\n\nfunction renderStructuredMessage(record: LogRecord, template: boolean): string {\n if (template) {\n if (typeof record.rawMessage === \"string\") return record.rawMessage;\n return record.rawMessage.join(\"{}\");\n }\n\n return renderMessageParts(record.message, stringifyLogfmtValue);\n}\n\nfunction filterLogfmtKey(key: string): string | null {\n if (key === \"\") return null;\n\n let needsEscape: boolean = false;\n for (const char of key) {\n const code: number = char.codePointAt(0)!;\n if (shouldEscapeLogfmtKeyChar(char, code)) {\n needsEscape = true;\n break;\n }\n }\n if (!needsEscape) return key;\n\n let result: string = \"\";\n for (const char of key) {\n const code: number = char.codePointAt(0)!;\n if (shouldEscapeLogfmtKeyChar(char, code)) {\n result += encodeLogfmtKeyChar(char);\n } else {\n result += char;\n }\n }\n return result;\n}\n\nfunction shouldEscapeLogfmtKeyChar(char: string, code: number): boolean {\n return code <= 0x20 || code === 0x7f || code === 0xfffd ||\n char === \"=\" || char === '\"' || char === \"%\";\n}\n\nfunction encodeLogfmtKeyChar(char: string): string {\n let result: string = \"\";\n for (const byte of utf8Encoder.encode(char)) {\n result += `%${byte.toString(16).toUpperCase().padStart(2, \"0\")}`;\n }\n return result;\n}\n\nfunction stringifyLogfmtValue(value: unknown): string {\n if (typeof value === \"string\") return value;\n if (value === null) return \"null\";\n if (\n typeof value === \"number\" || typeof value === \"boolean\" ||\n typeof value === \"bigint\" || typeof value === \"undefined\" ||\n typeof value === \"symbol\" || typeof value === \"function\"\n ) {\n return String(value);\n }\n\n try {\n const json: string | undefined = JSON.stringify(value, jsonReplacer);\n if (typeof json === \"string\") return unwrapJsonStringLiteral(json);\n } catch {\n // Fall back to inspect below.\n }\n\n return inspect(value, { colors: false });\n}\n\nfunction unwrapJsonStringLiteral(json: string): string {\n if (json.startsWith('\"') && json.endsWith('\"')) {\n return JSON.parse(json) as string;\n }\n return json;\n}\n\nfunction quoteLogfmtValue(value: string, isString: boolean): string {\n let needsQuote: boolean = value === \"\" ||\n isString && shouldQuoteStringLiteral(value);\n\n for (const char of value) {\n const code: number = char.codePointAt(0)!;\n if (shouldQuoteLogfmtValueChar(char, code)) {\n needsQuote = true;\n break;\n }\n }\n if (!needsQuote) return value;\n\n let quoted: string = \"\";\n for (const char of value) {\n const code: number = char.codePointAt(0)!;\n quoted += escapeLogfmtValueChar(char, code);\n }\n return `\"${quoted}\"`;\n}\n\nfunction shouldQuoteStringLiteral(value: string): boolean {\n return value === \"null\" || value === \"undefined\" || value === \"true\" ||\n value === \"false\";\n}\n\nfunction shouldQuoteLogfmtValueChar(char: string, code: number): boolean {\n return code <= 0x20 || code === 0x7f || code === 0xfffd ||\n char === \"=\" || char === '\"' || char === \"\\\\\";\n}\n\nfunction escapeLogfmtValueChar(char: string, code: number): string {\n switch (char) {\n case \"\\t\":\n return \"\\\\t\";\n case \"\\n\":\n return \"\\\\n\";\n case \"\\r\":\n return \"\\\\r\";\n case '\"':\n return '\\\\\"';\n case \"\\\\\":\n return \"\\\\\\\\\";\n default:\n return code <= 0x1f || code === 0x7f\n ? `\\\\u${code.toString(16).padStart(4, \"0\")}`\n : char;\n }\n}\n\nfunction formatLogfmtValue(value: unknown): string {\n const stringified = stringifyLogfmtValue(value);\n return quoteLogfmtValue(stringified, typeof value === \"string\");\n}\n\nfunction pushLogfmtPair(\n pairs: string[],\n key: string,\n value: unknown,\n): void {\n const filteredKey = filterLogfmtKey(key);\n if (filteredKey == null) return;\n pairs.push(`${filteredKey}=${formatLogfmtValue(value)}`);\n}\n\n/**\n * Get a [logfmt] formatter with the specified options. The log records\n * will be rendered as space-delimited key-value pairs, one record per line.\n * It looks like this:\n *\n * ```text\n * time=2023-11-14T22:13:20.000Z level=info logger=my.logger msg=\"Hello, world!\" key=value\n * ```\n *\n * [logfmt]: https://brandur.org/logfmt\n * @param options The options for the logfmt formatter.\n * @returns The logfmt formatter.\n * @since 2.1.0\n */\nexport function getLogfmtFormatter(\n options: LogfmtFormatterOptions = {},\n): TextFormatter {\n const prependPrefix: string = \"prepend:\";\n const lineEnding: string = getLineEndingValue(options.lineEnding);\n const timestampRenderer: (ts: number) => string | null =\n createTimestampFormatter(\n \"rfc3339\",\n resolveTimeZone(options.timeZone),\n );\n const isTemplateMessage: boolean = options.message === \"template\";\n const propertiesOption: \"flatten\" | `prepend:${string}` =\n options.properties ?? \"flatten\";\n\n let joinCategory: (category: readonly string[]) => string;\n if (typeof options.categorySeparator === \"function\") {\n joinCategory = options.categorySeparator;\n } else {\n const separator = options.categorySeparator ?? \".\";\n joinCategory = (category: readonly string[]): string =>\n category.join(separator);\n }\n\n let propertyPrefix: string = \"\";\n if (propertiesOption === \"flatten\") {\n propertyPrefix = \"\";\n } else if (propertiesOption.startsWith(prependPrefix)) {\n propertyPrefix = propertiesOption.substring(prependPrefix.length);\n if (propertyPrefix === \"\") {\n throw new TypeError(\n \"Invalid properties option: \" + JSON.stringify(propertiesOption) +\n \". \" +\n 'It must be of the form \"prepend:<prefix>\" where <prefix> is a ' +\n \"non-empty string.\",\n );\n }\n } else {\n throw new TypeError(\n `Invalid properties option: ${\n JSON.stringify(propertiesOption)\n }. It must be \"flatten\" or \"prepend:<prefix>\".`,\n );\n }\n\n return (record: LogRecord): string => {\n const pairs: string[] = [];\n pushLogfmtPair(pairs, \"time\", timestampRenderer(record.timestamp));\n pushLogfmtPair(pairs, \"level\", record.level);\n pushLogfmtPair(pairs, \"logger\", joinCategory(record.category));\n pushLogfmtPair(\n pairs,\n \"msg\",\n renderStructuredMessage(\n record,\n isTemplateMessage,\n ),\n );\n\n for (const key in record.properties) {\n if (Object.prototype.hasOwnProperty.call(record.properties, key)) {\n pushLogfmtPair(\n pairs,\n `${propertyPrefix}${key}`,\n record.properties[key],\n );\n }\n }\n\n return `${pairs.join(\" \")}${lineEnding}`;\n };\n}\n\n/**\n * The default [logfmt] formatter. This formatter formats log records as\n * space-delimited key-value pairs, one record per line.\n *\n * [logfmt]: https://brandur.org/logfmt\n * @since 2.1.0\n */\nexport const logfmtFormatter: TextFormatter = getLogfmtFormatter();\n\n/**\n * A console formatter is a function that accepts a log record and returns\n * an array of arguments to pass to {@link console.log}.\n *\n * @param record The log record to format.\n * @returns The formatted log record, as an array of arguments for\n * {@link console.log}.\n */\nexport type ConsoleFormatter = (record: LogRecord) => readonly unknown[];\n\n/**\n * The styles for the log level in the console.\n */\nconst logLevelStyles: Record<LogLevel, string> = {\n \"trace\": \"background-color: gray; color: white;\",\n \"debug\": \"background-color: gray; color: white;\",\n \"info\": \"background-color: white; color: black;\",\n \"warning\": \"background-color: orange; color: black;\",\n \"error\": \"background-color: red; color: white;\",\n \"fatal\": \"background-color: maroon; color: white;\",\n};\n\n/**\n * The default console formatter.\n *\n * @param record The log record to format.\n * @returns The formatted log record, as an array of arguments for\n * {@link console.log}.\n */\nexport function defaultConsoleFormatter(record: LogRecord): readonly unknown[] {\n let msg = \"\";\n const values: unknown[] = [];\n for (let i = 0; i < record.message.length; i++) {\n if (i % 2 === 0) msg += record.message[i];\n else {\n msg += \"%o\";\n values.push(record.message[i]);\n }\n }\n const date = new Date(record.timestamp);\n const time = `${date.getUTCHours().toString().padStart(2, \"0\")}:${\n date.getUTCMinutes().toString().padStart(2, \"0\")\n }:${date.getUTCSeconds().toString().padStart(2, \"0\")}.${\n date.getUTCMilliseconds().toString().padStart(3, \"0\")\n }`;\n return [\n `%c${time} %c${levelAbbreviations[record.level]}%c %c${\n record.category.join(\"\\xb7\")\n } %c${msg}`,\n \"color: gray;\",\n logLevelStyles[record.level],\n \"background-color: default;\",\n \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E,IAAI,MAAM;CACV,MAAMsC,SAAoB,CAAE;AAC5B,MAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,QAAQ,IACzC,KAAI,IAAI,MAAM,EAAG,QAAO,OAAO,QAAQ;MAClC;AACH,SAAO;AACP,SAAO,KAAK,OAAO,QAAQ,GAAG;CAC/B;CAEH,MAAM,OAAO,IAAI,KAAK,OAAO;CAC7B,MAAM,QAAQ,EAAE,KAAK,aAAa,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,GAC7D,KAAK,eAAe,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CACjD,GAAG,KAAK,eAAe,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,GACnD,KAAK,oBAAoB,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CACtD;AACD,QAAO;GACJ,IAAI,KAAK,KAAK,mBAAmB,OAAO,OAAO,OAC9C,OAAO,SAAS,KAAK,IAAO,CAC7B,KAAK,IAAI;EACV;EACA,eAAe,OAAO;EACtB;EACA;EACA;EACA,GAAG;CACJ;AACF"}
|
|
1
|
+
{"version":3,"file":"formatter.js","names":["levelAbbreviations: Record<LogLevel, string>","platformInspect: (\n value: unknown,\n options?: { colors?: boolean },\n) => string | undefined","inspect: (value: unknown, options?: { colors?: boolean }) => string","value: unknown","options?: { colors?: boolean }","msgParts: readonly unknown[]","valueRenderer: (value: unknown) => string","msgLen: number","message: string","parts: string[]","num: number","minutes: number","full: boolean","formatter: Intl.DateTimeFormat","ts: number","config: TimeZoneConfig","timeZone: string | null | undefined","pattern: TimestampPattern","timeZone: TimeZoneConfig","lineEnding?: \"lf\" | \"crlf\"","_key: string","serialized: Record<string, unknown>","message: readonly unknown[]","key: string","record: LogRecord","lineEnding: string","messageJson: string | undefined","propertiesJson: string | undefined","options: TextFormatterOptions","v: unknown","level: LogLevel","formatter: (values: FormattedValues) => string","values: FormattedValues","defaultTextFormatter: TextFormatter","ansiColors: Record<AnsiColor, string>","ansiStyles: Record<AnsiStyle, string>","defaultLevelColors: Record<LogLevel, AnsiColor | null>","options: AnsiColorFormatterOptions","ansiColorFormatter: TextFormatter","options: JsonLinesFormatterOptions","joinCategory: (category: readonly string[]) => string | readonly string[]","category: readonly string[]","getProperties: (\n properties: Record<string, unknown>,\n ) => Record<string, unknown>","result: Record<string, unknown>","getMessage: (record: LogRecord) => string","jsonLinesFormatter: TextFormatter","template: boolean","needsEscape: boolean","code: number","result: string","char: string","json: string | undefined","json: string","value: string","isString: boolean","needsQuote: boolean","quoted: string","pairs: string[]","options: LogfmtFormatterOptions","prependPrefix: string","timestampRenderer: (ts: number) => string | null","isTemplateMessage: boolean","propertiesOption: \"flatten\" | `prepend:${string}`","joinCategory: (category: readonly string[]) => string","propertyPrefix: string","logfmtFormatter: TextFormatter","logLevelStyles: Record<LogLevel, string>","values: unknown[]"],"sources":["../src/formatter.ts"],"sourcesContent":["import * as util from \"#util\";\nimport type { LogLevel } from \"./level.ts\";\nimport type { LogRecord } from \"./record.ts\";\n\n/**\n * A text formatter is a function that accepts a log record and returns\n * a string.\n *\n * @param record The log record to format.\n * @returns The formatted log record.\n */\nexport type TextFormatter = (record: LogRecord) => string;\n\n/**\n * The severity level abbreviations.\n */\nconst levelAbbreviations: Record<LogLevel, string> = {\n \"trace\": \"TRC\",\n \"debug\": \"DBG\",\n \"info\": \"INF\",\n \"warning\": \"WRN\",\n \"error\": \"ERR\",\n \"fatal\": \"FTL\",\n};\n\n/**\n * A platform-specific inspect function. In Deno, this is {@link Deno.inspect},\n * and in Node.js/Bun it is `util.inspect()`. If neither is available, it\n * falls back to {@link JSON.stringify}.\n *\n * @param value The value to inspect.\n * @param options The options for inspecting the value.\n * If `colors` is `true`, the output will be ANSI-colored.\n * @returns The string representation of the value.\n */\nconst platformInspect: (\n value: unknown,\n options?: { colors?: boolean },\n) => string | undefined =\n // @ts-ignore: Browser detection\n // dnt-shim-ignore\n typeof document !== \"undefined\" ||\n // @ts-ignore: React Native detection\n // dnt-shim-ignore\n typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\"\n ? (v) => JSON.stringify(v)\n // @ts-ignore: Deno global\n // dnt-shim-ignore\n : \"Deno\" in globalThis && \"inspect\" in globalThis.Deno &&\n // @ts-ignore: Deno global\n // dnt-shim-ignore\n typeof globalThis.Deno.inspect === \"function\"\n ? (v, opts) =>\n // @ts-ignore: Deno global\n // dnt-shim-ignore\n globalThis.Deno.inspect(v, {\n strAbbreviateSize: Infinity,\n iterableLimit: Infinity,\n ...opts,\n })\n // @ts-ignore: Node.js global\n // dnt-shim-ignore\n : util != null && \"inspect\" in util && typeof util.inspect === \"function\"\n ? (v, opts) =>\n // @ts-ignore: Node.js global\n // dnt-shim-ignore\n util.inspect(v, {\n maxArrayLength: Infinity,\n maxStringLength: Infinity,\n ...opts,\n })\n : (v) => JSON.stringify(v);\n\nconst inspect: (value: unknown, options?: { colors?: boolean }) => string = (\n value: unknown,\n options?: { colors?: boolean },\n): string => String(platformInspect(value, options));\n\nconst utf8Encoder = new TextEncoder();\n\nfunction renderMessageParts(\n msgParts: readonly unknown[],\n valueRenderer: (value: unknown) => string,\n): string {\n const msgLen: number = msgParts.length;\n\n if (msgLen === 1) {\n return msgParts[0] as string;\n }\n\n if (msgLen <= 6) {\n let message: string = \"\";\n for (let i = 0; i < msgLen; i++) {\n message += (i % 2 === 0)\n ? msgParts[i] as string\n : valueRenderer(msgParts[i]);\n }\n return message;\n }\n\n const parts: string[] = new Array(msgLen);\n for (let i = 0; i < msgLen; i++) {\n parts[i] = (i % 2 === 0)\n ? msgParts[i] as string\n : valueRenderer(msgParts[i]);\n }\n return parts.join(\"\");\n}\n\n/**\n * The formatted values for a log record.\n * @since 0.6.0\n */\nexport interface FormattedValues {\n /**\n * The formatted timestamp.\n */\n timestamp: string | null;\n\n /**\n * The formatted log level.\n */\n level: string;\n\n /**\n * The formatted category.\n */\n category: string;\n\n /**\n * The formatted message.\n */\n message: string;\n\n /**\n * The unformatted log record.\n */\n record: LogRecord;\n}\n\n/**\n * The various options for the built-in text formatters.\n * @since 0.6.0\n */\nexport interface TextFormatterOptions {\n /**\n * The timestamp format. This can be one of the following:\n *\n * - `\"date-time-timezone\"`: The date and time with the full timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000 +00:00\"`).\n * - `\"date-time-tz\"`: The date and time with the short timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000 +00\"`).\n * - `\"date-time\"`: The date and time without the timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000\"`).\n * - `\"time-timezone\"`: The time with the full timezone offset but without\n * the date (e.g., `\"22:13:20.000 +00:00\"`).\n * - `\"time-tz\"`: The time with the short timezone offset but without the date\n * (e.g., `\"22:13:20.000 +00\"`).\n * - `\"time\"`: The time without the date or timezone offset\n * (e.g., `\"22:13:20.000\"`).\n * - `\"date\"`: The date without the time or timezone offset\n * (e.g., `\"2023-11-14\"`).\n * - `\"rfc3339\"`: The date and time in RFC 3339 format\n * (e.g., `\"2023-11-14T22:13:20.000Z\"`).\n * - `\"none\"` or `\"disabled\"`: No display\n *\n * Alternatively, this can be a function that accepts a timestamp and returns\n * a string.\n *\n * The default is `\"date-time-timezone\"`.\n */\n timestamp?:\n | \"date-time-timezone\"\n | \"date-time-tz\"\n | \"date-time\"\n | \"time-timezone\"\n | \"time-tz\"\n | \"time\"\n | \"date\"\n | \"rfc3339\"\n | \"none\"\n | \"disabled\"\n | ((ts: number) => string | null);\n\n /**\n * The timezone used for timestamp rendering.\n *\n * - `undefined` (default): UTC (preserves existing behavior)\n * - `null`: System local timezone\n * - IANA timezone name such as `\"America/Bogota\"` or `\"Asia/Seoul\"`\n * - Fixed UTC offset string such as `\"+09:00\"` or `\"-05:00\"`\n *\n * @since 2.1.0\n */\n timeZone?: string | null;\n\n /**\n * The log level format. This can be one of the following:\n *\n * - `\"ABBR\"`: The log level abbreviation in uppercase (e.g., `\"INF\"`).\n * - `\"FULL\"`: The full log level name in uppercase (e.g., `\"INFO\"`).\n * - `\"L\"`: The first letter of the log level in uppercase (e.g., `\"I\"`).\n * - `\"abbr\"`: The log level abbreviation in lowercase (e.g., `\"inf\"`).\n * - `\"full\"`: The full log level name in lowercase (e.g., `\"info\"`).\n * - `\"l\"`: The first letter of the log level in lowercase (e.g., `\"i\"`).\n *\n * Alternatively, this can be a function that accepts a log level and returns\n * a string.\n *\n * The default is `\"ABBR\"`.\n */\n level?:\n | \"ABBR\"\n | \"FULL\"\n | \"L\"\n | \"abbr\"\n | \"full\"\n | \"l\"\n | ((level: LogLevel) => string);\n\n /**\n * The separator between category names. For example, if the separator is\n * `\"·\"`, the category `[\"a\", \"b\", \"c\"]` will be formatted as `\"a·b·c\"`.\n * The default separator is `\"·\"`.\n *\n * If this is a function, it will be called with the category array and\n * should return a string, which will be used for rendering the category.\n */\n category?: string | ((category: readonly string[]) => string);\n\n /**\n * The format of the embedded values.\n *\n * A function that renders a value to a string. This function is used to\n * render the values in the log record. The default is a cross-runtime\n * `inspect()` function that uses [`util.inspect()`] in Node.js/Bun,\n * [`Deno.inspect()`] in Deno, or falls back to {@link JSON.stringify} in\n * browsers.\n *\n * The second parameter provides access to the default cross-runtime\n * `inspect()` function, allowing you to fall back to the default behavior\n * for certain values while customizing others. You can ignore this\n * parameter if you don't need the fallback functionality.\n *\n * [`util.inspect()`]: https://nodejs.org/api/util.html#utilinspectobject-options\n * [`Deno.inspect()`]: https://docs.deno.com/api/deno/~/Deno.inspect\n * @param value The value to render.\n * @param inspect The default cross-runtime inspect function that can be used\n * as a fallback. Accepts an optional `options` parameter\n * with a `colors` boolean field.\n * @returns The string representation of the value.\n * @example\n * ```typescript\n * getTextFormatter({\n * value(value, inspect) {\n * // Custom formatting for numbers\n * if (typeof value === 'number') {\n * return value.toFixed(2);\n * }\n * // Fall back to default for everything else\n * return inspect(value);\n * }\n * })\n * ```\n */\n value?: (\n value: unknown,\n inspect: (value: unknown, options?: { colors?: boolean }) => string,\n ) => string;\n\n /**\n * How those formatted parts are concatenated.\n *\n * A function that formats the log record. This function is called with the\n * formatted values and should return a string. Note that the formatted\n * *should not* include a newline character at the end.\n *\n * By default, this is a function that formats the log record as follows:\n *\n * ```\n * 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!\n * ```\n * @param values The formatted values.\n * @returns The formatted log record.\n */\n format?: (values: FormattedValues) => string;\n\n /**\n * Line ending style for formatted output.\n *\n * - `\"lf\"`: Unix-style line endings (`\\n`)\n * - `\"crlf\"`: Windows-style line endings (`\\r\\n`)\n *\n * @default \"lf\"\n * @since 2.0.0\n */\n lineEnding?: \"lf\" | \"crlf\";\n}\n\n// Optimized helper functions for timestamp formatting\nfunction padZero(num: number): string {\n return num < 10 ? `0${num}` : `${num}`;\n}\n\nfunction padThree(num: number): string {\n return num < 10 ? `00${num}` : num < 100 ? `0${num}` : `${num}`;\n}\n\ntype TimestampPattern =\n | \"date-time-timezone\"\n | \"date-time-tz\"\n | \"date-time\"\n | \"time-timezone\"\n | \"time-tz\"\n | \"time\"\n | \"date\"\n | \"rfc3339\"\n | \"none\";\n\ntype TimeZoneConfig =\n | { kind: \"utc\" }\n | { kind: \"local\" }\n | { kind: \"offset\"; minutes: number }\n | { kind: \"iana\"; formatter: Intl.DateTimeFormat };\n\ntype DateParts = {\n year: string;\n month: string;\n day: string;\n hour: string;\n minute: string;\n second: string;\n ms: string;\n offsetMinutes: number;\n};\n\nconst fixedOffsetPattern = /^([+-])(0\\d|1\\d|2[0-3]):([0-5]\\d)$/;\n\nfunction formatOffset(minutes: number, full: boolean): string {\n const sign = minutes < 0 ? \"-\" : \"+\";\n const absolute = Math.abs(minutes);\n const hour = padZero(Math.floor(absolute / 60));\n const minute = padZero(absolute % 60);\n if (!full && minute === \"00\") return `${sign}${hour}`;\n return `${sign}${hour}:${minute}`;\n}\n\nfunction readPartsFromFormatter(\n formatter: Intl.DateTimeFormat,\n ts: number,\n): Omit<DateParts, \"ms\" | \"offsetMinutes\"> {\n const parts = formatter.formatToParts(new Date(ts));\n let year = \"\";\n let month = \"\";\n let day = \"\";\n let hour = \"\";\n let minute = \"\";\n let second = \"\";\n for (const part of parts) {\n if (part.type === \"year\") year = part.value;\n else if (part.type === \"month\") month = part.value;\n else if (part.type === \"day\") day = part.value;\n else if (part.type === \"hour\") hour = part.value;\n else if (part.type === \"minute\") minute = part.value;\n else if (part.type === \"second\") second = part.value;\n }\n return { year, month, day, hour, minute, second };\n}\n\nfunction getDateParts(ts: number, config: TimeZoneConfig): DateParts {\n const d = new Date(ts);\n const ms = padThree(d.getUTCMilliseconds());\n\n if (config.kind === \"utc\") {\n return {\n year: `${d.getUTCFullYear()}`,\n month: padZero(d.getUTCMonth() + 1),\n day: padZero(d.getUTCDate()),\n hour: padZero(d.getUTCHours()),\n minute: padZero(d.getUTCMinutes()),\n second: padZero(d.getUTCSeconds()),\n ms,\n offsetMinutes: 0,\n };\n }\n\n if (config.kind === \"local\") {\n return {\n year: `${d.getFullYear()}`,\n month: padZero(d.getMonth() + 1),\n day: padZero(d.getDate()),\n hour: padZero(d.getHours()),\n minute: padZero(d.getMinutes()),\n second: padZero(d.getSeconds()),\n ms,\n offsetMinutes: -d.getTimezoneOffset(),\n };\n }\n\n if (config.kind === \"offset\") {\n const shifted = new Date(ts + config.minutes * 60_000);\n return {\n year: `${shifted.getUTCFullYear()}`,\n month: padZero(shifted.getUTCMonth() + 1),\n day: padZero(shifted.getUTCDate()),\n hour: padZero(shifted.getUTCHours()),\n minute: padZero(shifted.getUTCMinutes()),\n second: padZero(shifted.getUTCSeconds()),\n ms,\n offsetMinutes: config.minutes,\n };\n }\n\n const parts = readPartsFromFormatter(config.formatter, ts);\n const asUtc = Date.UTC(\n Number(parts.year),\n Number(parts.month) - 1,\n Number(parts.day),\n Number(parts.hour),\n Number(parts.minute),\n Number(parts.second),\n d.getUTCMilliseconds(),\n );\n const offsetMinutes = Math.round((asUtc - ts) / 60_000);\n return { ...parts, ms, offsetMinutes };\n}\n\nfunction resolveTimeZone(timeZone: string | null | undefined): TimeZoneConfig {\n if (typeof timeZone === \"undefined\") return { kind: \"utc\" };\n if (timeZone === null) return { kind: \"local\" };\n\n const offsetMatch = fixedOffsetPattern.exec(timeZone);\n if (offsetMatch != null) {\n const sign = offsetMatch[1] === \"-\" ? -1 : 1;\n const hours = Number(offsetMatch[2]);\n const minutes = Number(offsetMatch[3]);\n return { kind: \"offset\", minutes: sign * (hours * 60 + minutes) };\n }\n\n if (\n typeof Intl === \"undefined\" || typeof Intl.DateTimeFormat !== \"function\"\n ) {\n throw new TypeError(\n `Invalid timeZone option: ${\n JSON.stringify(timeZone)\n }. This environment does not support IANA time zones.`,\n );\n }\n\n try {\n return {\n kind: \"iana\",\n formatter: new Intl.DateTimeFormat(\"en-CA\", {\n timeZone,\n hour12: false,\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n }),\n };\n } catch {\n throw new TypeError(\n `Invalid timeZone option: ${\n JSON.stringify(timeZone)\n }. Expected an IANA time zone name (e.g., \"Asia/Seoul\") or a fixed UTC offset string (e.g., \"+09:00\").`,\n );\n }\n}\n\nfunction createTimestampFormatter(\n pattern: TimestampPattern,\n timeZone: TimeZoneConfig,\n): (ts: number) => string | null {\n if (pattern === \"none\") return () => null;\n if (pattern === \"rfc3339\" && timeZone.kind === \"utc\") {\n return (ts: number): string => new Date(ts).toISOString();\n }\n\n return (ts: number): string => {\n const parts = getDateParts(ts, timeZone);\n const date = `${parts.year}-${parts.month}-${parts.day}`;\n const time = `${parts.hour}:${parts.minute}:${parts.second}.${parts.ms}`;\n const tzLong = formatOffset(parts.offsetMinutes, true);\n const tzShort = formatOffset(parts.offsetMinutes, false);\n\n if (pattern === \"date-time-timezone\") return `${date} ${time} ${tzLong}`;\n if (pattern === \"date-time-tz\") return `${date} ${time} ${tzShort}`;\n if (pattern === \"date-time\") return `${date} ${time}`;\n if (pattern === \"time-timezone\") return `${time} ${tzLong}`;\n if (pattern === \"time-tz\") return `${time} ${tzShort}`;\n if (pattern === \"time\") return time;\n if (pattern === \"date\") return date;\n return `${date}T${time}${tzLong}`;\n };\n}\n\n// Pre-computed level renderers for common cases\nconst levelRenderersCache = {\n ABBR: levelAbbreviations,\n abbr: {\n trace: \"trc\",\n debug: \"dbg\",\n info: \"inf\",\n warning: \"wrn\",\n error: \"err\",\n fatal: \"ftl\",\n } as const,\n FULL: {\n trace: \"TRACE\",\n debug: \"DEBUG\",\n info: \"INFO\",\n warning: \"WARNING\",\n error: \"ERROR\",\n fatal: \"FATAL\",\n } as const,\n full: {\n trace: \"trace\",\n debug: \"debug\",\n info: \"info\",\n warning: \"warning\",\n error: \"error\",\n fatal: \"fatal\",\n } as const,\n L: {\n trace: \"T\",\n debug: \"D\",\n info: \"I\",\n warning: \"W\",\n error: \"E\",\n fatal: \"F\",\n } as const,\n l: {\n trace: \"t\",\n debug: \"d\",\n info: \"i\",\n warning: \"w\",\n error: \"e\",\n fatal: \"f\",\n } as const,\n} as const;\n\n/**\n * Helper function to get the line ending value based on the option.\n * @param lineEnding The line ending option.\n * @returns The line ending string.\n */\nfunction getLineEndingValue(lineEnding?: \"lf\" | \"crlf\"): string {\n return lineEnding === \"crlf\" ? \"\\r\\n\" : \"\\n\";\n}\n\nfunction jsonReplacer(_key: string, value: unknown): unknown {\n if (!(value instanceof Error)) return value;\n\n const serialized: Record<string, unknown> = {\n name: value.name,\n message: value.message,\n };\n\n if (typeof value.stack === \"string\") {\n serialized.stack = value.stack;\n }\n\n const cause = (value as { cause?: unknown }).cause;\n if (cause !== undefined) {\n serialized.cause = cause;\n }\n\n if (\n typeof AggregateError !== \"undefined\" &&\n value instanceof AggregateError\n ) {\n serialized.errors = value.errors;\n }\n\n for (const key of Object.keys(value)) {\n if (!(key in serialized)) {\n serialized[key] = (value as unknown as Record<string, unknown>)[key];\n }\n }\n\n return serialized;\n}\n\nfunction renderDefaultJsonLinesMessage(\n message: readonly unknown[],\n): unknown {\n const messageLength = message.length;\n if (messageLength === 1) {\n return message[0];\n }\n if (messageLength === 3) {\n return (message[0] as string) + JSON.stringify(message[1]) +\n (message[2] as string);\n }\n\n let rendered = message[0] as string;\n for (let i = 1; i < messageLength; i++) {\n rendered += (i & 1) ? JSON.stringify(message[i]) : message[i];\n }\n return rendered;\n}\n\nfunction stringifyJsonLinesField(\n key: string,\n value: unknown,\n): string | undefined {\n if (\n value != null &&\n (typeof value === \"object\" ||\n typeof value === \"function\" ||\n typeof value === \"bigint\")\n ) {\n const toJSON = (value as { toJSON?: unknown }).toJSON;\n if (typeof toJSON === \"function\") {\n value = toJSON.call(value, key);\n }\n }\n return JSON.stringify(jsonReplacer(key, value), jsonReplacer);\n}\n\nfunction formatDefaultJsonLinesRecord(\n record: LogRecord,\n lineEnding: string,\n): string {\n const level = record.level === \"warning\"\n ? \"WARN\"\n : record.level.toUpperCase();\n const messageJson: string | undefined = stringifyJsonLinesField(\n \"message\",\n renderDefaultJsonLinesMessage(record.message),\n );\n const propertiesJson: string | undefined = stringifyJsonLinesField(\n \"properties\",\n record.properties,\n );\n\n // The default formatter always emits the same object shape, so build the\n // fixed JSON shell directly while preserving JSON.stringify() escaping,\n // toJSON field keys, Error serialization, and unsupported-value failures.\n let line = `{\"@timestamp\":${\n JSON.stringify(new Date(record.timestamp).toISOString())\n },\"level\":${JSON.stringify(level)}`;\n if (messageJson !== undefined) {\n line += `,\"message\":${messageJson}`;\n }\n line += `,\"logger\":${JSON.stringify(record.category.join(\".\"))}`;\n if (propertiesJson !== undefined) {\n line += `,\"properties\":${propertiesJson}`;\n }\n return `${line}}${lineEnding}`;\n}\n\n/**\n * Get a text formatter with the specified options. Although it's flexible\n * enough to create a custom formatter, if you want more control, you can\n * create a custom formatter that satisfies the {@link TextFormatter} type\n * instead.\n *\n * For more information on the options, see {@link TextFormatterOptions}.\n *\n * By default, the formatter formats log records as follows:\n *\n * ```\n * 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!\n * ```\n * @param options The options for the text formatter.\n * @returns The text formatter.\n * @since 0.6.0\n */\nexport function getTextFormatter(\n options: TextFormatterOptions = {},\n): TextFormatter {\n // Pre-compute timestamp formatter with optimized lookup\n const timestampRenderer = (() => {\n const tsOption = options.timestamp;\n const timeZone = resolveTimeZone(options.timeZone);\n if (tsOption == null) {\n return createTimestampFormatter(\"date-time-timezone\", timeZone);\n } else if (tsOption === \"disabled\") {\n return createTimestampFormatter(\"none\", timeZone);\n } else if (\n typeof tsOption === \"string\" &&\n (\n tsOption === \"date-time-timezone\" ||\n tsOption === \"date-time-tz\" ||\n tsOption === \"date-time\" ||\n tsOption === \"time-timezone\" ||\n tsOption === \"time-tz\" ||\n tsOption === \"time\" ||\n tsOption === \"date\" ||\n tsOption === \"rfc3339\" ||\n tsOption === \"none\"\n )\n ) {\n return createTimestampFormatter(tsOption, timeZone);\n } else {\n return tsOption as (ts: number) => string | null;\n }\n })();\n\n const categorySeparator = options.category ?? \"·\";\n const valueRenderer = options.value\n ? (v: unknown) => options.value!(v, inspect)\n : inspect;\n\n // Pre-compute level renderer for better performance\n const levelRenderer = (() => {\n const levelOption = options.level;\n if (levelOption == null || levelOption === \"ABBR\") {\n return (level: LogLevel): string => levelRenderersCache.ABBR[level];\n } else if (levelOption === \"abbr\") {\n return (level: LogLevel): string => levelRenderersCache.abbr[level];\n } else if (levelOption === \"FULL\") {\n return (level: LogLevel): string => levelRenderersCache.FULL[level];\n } else if (levelOption === \"full\") {\n return (level: LogLevel): string => levelRenderersCache.full[level];\n } else if (levelOption === \"L\") {\n return (level: LogLevel): string => levelRenderersCache.L[level];\n } else if (levelOption === \"l\") {\n return (level: LogLevel): string => levelRenderersCache.l[level];\n } else {\n return levelOption;\n }\n })();\n\n const lineEnding = getLineEndingValue(options.lineEnding);\n\n const formatter: (values: FormattedValues) => string = options.format ??\n (({ timestamp, level, category, message }: FormattedValues) =>\n `${timestamp ? `${timestamp} ` : \"\"}[${level}] ${category}: ${message}`);\n\n return (record: LogRecord): string => {\n const message: string = renderMessageParts(record.message, valueRenderer);\n\n const timestamp = timestampRenderer(record.timestamp);\n const level = levelRenderer(record.level);\n const category = typeof categorySeparator === \"function\"\n ? categorySeparator(record.category)\n : record.category.join(categorySeparator);\n\n const values: FormattedValues = {\n timestamp,\n level,\n category,\n message,\n record,\n };\n return `${formatter(values)}${lineEnding}`;\n };\n}\n\n/**\n * The default text formatter. This formatter formats log records as follows:\n *\n * ```\n * 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!\n * ```\n *\n * @param record The log record to format.\n * @returns The formatted log record.\n */\nexport const defaultTextFormatter: TextFormatter = getTextFormatter();\n\nconst RESET = \"\\x1b[0m\";\n\n/**\n * The ANSI colors. These can be used to colorize text in the console.\n * @since 0.6.0\n */\nexport type AnsiColor =\n | \"black\"\n | \"red\"\n | \"green\"\n | \"yellow\"\n | \"blue\"\n | \"magenta\"\n | \"cyan\"\n | \"white\";\n\nconst ansiColors: Record<AnsiColor, string> = {\n black: \"\\x1b[30m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n white: \"\\x1b[37m\",\n};\n\n/**\n * The ANSI text styles.\n * @since 0.6.0\n */\nexport type AnsiStyle =\n | \"bold\"\n | \"dim\"\n | \"italic\"\n | \"underline\"\n | \"strikethrough\";\n\nconst ansiStyles: Record<AnsiStyle, string> = {\n bold: \"\\x1b[1m\",\n dim: \"\\x1b[2m\",\n italic: \"\\x1b[3m\",\n underline: \"\\x1b[4m\",\n strikethrough: \"\\x1b[9m\",\n};\n\nconst defaultLevelColors: Record<LogLevel, AnsiColor | null> = {\n trace: null,\n debug: \"blue\",\n info: \"green\",\n warning: \"yellow\",\n error: \"red\",\n fatal: \"magenta\",\n};\n\n/**\n * The various options for the ANSI color formatter.\n * @since 0.6.0\n */\nexport interface AnsiColorFormatterOptions extends TextFormatterOptions {\n /**\n * The timestamp format. This can be one of the following:\n *\n * - `\"date-time-timezone\"`: The date and time with the full timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000 +00:00\"`).\n * - `\"date-time-tz\"`: The date and time with the short timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000 +00\"`).\n * - `\"date-time\"`: The date and time without the timezone offset\n * (e.g., `\"2023-11-14 22:13:20.000\"`).\n * - `\"time-timezone\"`: The time with the full timezone offset but without\n * the date (e.g., `\"22:13:20.000 +00:00\"`).\n * - `\"time-tz\"`: The time with the short timezone offset but without the date\n * (e.g., `\"22:13:20.000 +00\"`).\n * - `\"time\"`: The time without the date or timezone offset\n * (e.g., `\"22:13:20.000\"`).\n * - `\"date\"`: The date without the time or timezone offset\n * (e.g., `\"2023-11-14\"`).\n * - `\"rfc3339\"`: The date and time in RFC 3339 format\n * (e.g., `\"2023-11-14T22:13:20.000Z\"`).\n *\n * Alternatively, this can be a function that accepts a timestamp and returns\n * a string.\n *\n * The default is `\"date-time-tz\"`.\n */\n timestamp?:\n | \"date-time-timezone\"\n | \"date-time-tz\"\n | \"date-time\"\n | \"time-timezone\"\n | \"time-tz\"\n | \"time\"\n | \"date\"\n | \"rfc3339\"\n | \"none\"\n | \"disabled\"\n | ((ts: number) => string | null);\n\n /**\n * The ANSI style for the timestamp. `\"dim\"` is used by default.\n */\n timestampStyle?: AnsiStyle | null;\n\n /**\n * The ANSI color for the timestamp. No color is used by default.\n */\n timestampColor?: AnsiColor | null;\n\n /**\n * The ANSI style for the log level. `\"bold\"` is used by default.\n */\n levelStyle?: AnsiStyle | null;\n\n /**\n * The ANSI colors for the log levels. The default colors are as follows:\n *\n * - `\"trace\"`: `null` (no color)\n * - `\"debug\"`: `\"blue\"`\n * - `\"info\"`: `\"green\"`\n * - `\"warning\"`: `\"yellow\"`\n * - `\"error\"`: `\"red\"`\n * - `\"fatal\"`: `\"magenta\"`\n */\n levelColors?: Record<LogLevel, AnsiColor | null>;\n\n /**\n * The ANSI style for the category. `\"dim\"` is used by default.\n */\n categoryStyle?: AnsiStyle | null;\n\n /**\n * The ANSI color for the category. No color is used by default.\n */\n categoryColor?: AnsiColor | null;\n}\n\n/**\n * Get an ANSI color formatter with the specified options.\n *\n * \n * @param option The options for the ANSI color formatter.\n * @returns The ANSI color formatter.\n * @since 0.6.0\n */\nexport function getAnsiColorFormatter(\n options: AnsiColorFormatterOptions = {},\n): TextFormatter {\n const format = options.format;\n const timestampStyle = typeof options.timestampStyle === \"undefined\"\n ? \"dim\"\n : options.timestampStyle;\n const timestampColor = options.timestampColor ?? null;\n const timestampPrefix = `${\n timestampStyle == null ? \"\" : ansiStyles[timestampStyle]\n }${timestampColor == null ? \"\" : ansiColors[timestampColor]}`;\n const timestampSuffix = timestampStyle == null && timestampColor == null\n ? \"\"\n : RESET;\n const levelStyle = typeof options.levelStyle === \"undefined\"\n ? \"bold\"\n : options.levelStyle;\n const levelColors = options.levelColors ?? defaultLevelColors;\n const categoryStyle = typeof options.categoryStyle === \"undefined\"\n ? \"dim\"\n : options.categoryStyle;\n const categoryColor = options.categoryColor ?? null;\n const categoryPrefix = `${\n categoryStyle == null ? \"\" : ansiStyles[categoryStyle]\n }${categoryColor == null ? \"\" : ansiColors[categoryColor]}`;\n const categorySuffix = categoryStyle == null && categoryColor == null\n ? \"\"\n : RESET;\n return getTextFormatter({\n timestamp: \"date-time-tz\",\n value(value: unknown, fallbackInspect): string {\n return fallbackInspect(value, { colors: true });\n },\n ...options,\n format({ timestamp, level, category, message, record }): string {\n const levelColor = levelColors[record.level];\n timestamp = timestamp == null\n ? null\n : `${timestampPrefix}${timestamp}${timestampSuffix}`;\n level = `${levelStyle == null ? \"\" : ansiStyles[levelStyle]}${\n levelColor == null ? \"\" : ansiColors[levelColor]\n }${level}${levelStyle == null && levelColor == null ? \"\" : RESET}`;\n return format == null\n ? `${\n timestamp == null ? \"\" : `${timestamp} `\n }${level} ${categoryPrefix}${category}:${categorySuffix} ${message}`\n : format({\n timestamp,\n level,\n category: `${categoryPrefix}${category}${categorySuffix}`,\n message,\n record,\n });\n },\n });\n}\n\n/**\n * A text formatter that uses ANSI colors to format log records.\n *\n * \n *\n * @param record The log record to format.\n * @returns The formatted log record.\n * @since 0.5.0\n */\nexport const ansiColorFormatter: TextFormatter = getAnsiColorFormatter();\n\n/**\n * Options for the {@link getJsonLinesFormatter} function.\n * @since 0.11.0\n */\nexport interface JsonLinesFormatterOptions {\n /**\n * The separator between category names. For example, if the separator is\n * `\".\"`, the category `[\"a\", \"b\", \"c\"]` will be formatted as `\"a.b.c\"`.\n * If this is a function, it will be called with the category array and\n * should return a string or an array of strings, which will be used\n * for rendering the category.\n *\n * @default `\".\"`\n */\n readonly categorySeparator?:\n | string\n | ((category: readonly string[]) => string | readonly string[]);\n\n /**\n * The message format. This can be one of the following:\n *\n * - `\"template\"`: The raw message template is used as the message.\n * - `\"rendered\"`: The message is rendered with the values.\n *\n * @default `\"rendered\"`\n */\n readonly message?: \"template\" | \"rendered\";\n\n /**\n * The properties format. This can be one of the following:\n *\n * - `\"flatten\"`: The properties are flattened into the root object.\n * - `\"prepend:<prefix>\"`: The properties are prepended with the given prefix\n * (e.g., `\"prepend:ctx_\"` will prepend `ctx_` to each property key).\n * - `\"nest:<key>\"`: The properties are nested under the given key\n * (e.g., `\"nest:properties\"` will nest the properties under the\n * `properties` key).\n *\n * @default `\"nest:properties\"`\n */\n readonly properties?: \"flatten\" | `prepend:${string}` | `nest:${string}`;\n\n /**\n * Line ending style for formatted output.\n *\n * - `\"lf\"`: Unix-style line endings (`\\n`)\n * - `\"crlf\"`: Windows-style line endings (`\\r\\n`)\n *\n * @default \"lf\"\n * @since 2.0.0\n */\n readonly lineEnding?: \"lf\" | \"crlf\";\n}\n\n/**\n * Get a [JSON Lines] formatter with the specified options. The log records\n * will be rendered as JSON objects, one per line, which is a common format\n * for log files. This format is also known as Newline-Delimited JSON (NDJSON).\n * It looks like this:\n *\n * ```json\n * {\"@timestamp\":\"2023-11-14T22:13:20.000Z\",\"level\":\"INFO\",\"message\":\"Hello, world!\",\"logger\":\"my.logger\",\"properties\":{\"key\":\"value\"}}\n * ```\n *\n * [JSON Lines]: https://jsonlines.org/\n * @param options The options for the JSON Lines formatter.\n * @returns The JSON Lines formatter.\n * @since 0.11.0\n */\nexport function getJsonLinesFormatter(\n options: JsonLinesFormatterOptions = {},\n): TextFormatter {\n const lineEnding = getLineEndingValue(options.lineEnding);\n\n // Most common configuration - optimize for the default case\n if (!options.categorySeparator && !options.message && !options.properties) {\n return (record: LogRecord): string =>\n formatDefaultJsonLinesRecord(record, lineEnding);\n }\n\n // Pre-compile configuration for non-default cases\n const isTemplateMessage = options.message === \"template\";\n const propertiesOption = options.properties ?? \"nest:properties\";\n\n // Pre-compile category joining strategy\n let joinCategory: (category: readonly string[]) => string | readonly string[];\n if (typeof options.categorySeparator === \"function\") {\n joinCategory = options.categorySeparator;\n } else {\n const separator = options.categorySeparator ?? \".\";\n joinCategory = (category: readonly string[]): string =>\n category.join(separator);\n }\n\n // Pre-compile properties handling strategy\n let getProperties: (\n properties: Record<string, unknown>,\n ) => Record<string, unknown>;\n\n if (propertiesOption === \"flatten\") {\n getProperties = (properties) => properties;\n } else if (propertiesOption.startsWith(\"prepend:\")) {\n const prefix = propertiesOption.substring(8);\n if (prefix === \"\") {\n throw new TypeError(\n `Invalid properties option: ${\n JSON.stringify(propertiesOption)\n }. It must be of the form \"prepend:<prefix>\" where <prefix> is a non-empty string.`,\n );\n }\n getProperties = (properties) => {\n const result: Record<string, unknown> = {};\n for (const key in properties) {\n result[`${prefix}${key}`] = properties[key];\n }\n return result;\n };\n } else if (propertiesOption.startsWith(\"nest:\")) {\n const key = propertiesOption.substring(5);\n getProperties = (properties) => ({ [key]: properties });\n } else {\n throw new TypeError(\n `Invalid properties option: ${\n JSON.stringify(propertiesOption)\n }. It must be \"flatten\", \"prepend:<prefix>\", or \"nest:<key>\".`,\n );\n }\n\n // Pre-compile message rendering function\n let getMessage: (record: LogRecord) => string;\n\n if (isTemplateMessage) {\n getMessage = (record: LogRecord): string => {\n if (typeof record.rawMessage === \"string\") {\n return record.rawMessage;\n }\n let msg = \"\";\n for (let i = 0; i < record.rawMessage.length; i++) {\n if (i > 0) msg += \"{}\";\n msg += record.rawMessage[i];\n }\n return msg;\n };\n } else {\n getMessage = (record: LogRecord): string => {\n const msgLen = record.message.length;\n\n if (msgLen === 1) {\n return record.message[0] as string;\n }\n\n let msg = \"\";\n for (let i = 0; i < msgLen; i++) {\n msg += (i % 2 < 1)\n ? record.message[i]\n : JSON.stringify(record.message[i]);\n }\n return msg;\n };\n }\n\n return (record: LogRecord): string => {\n return JSON.stringify({\n \"@timestamp\": new Date(record.timestamp).toISOString(),\n level: record.level === \"warning\" ? \"WARN\" : record.level.toUpperCase(),\n message: getMessage(record),\n logger: joinCategory(record.category),\n ...getProperties(record.properties),\n }, jsonReplacer) + lineEnding;\n };\n}\n\n/**\n * The default [JSON Lines] formatter. This formatter formats log records\n * as JSON objects, one per line, which is a common format for log files.\n * It looks like this:\n *\n * ```json\n * {\"@timestamp\":\"2023-11-14T22:13:20.000Z\",\"level\":\"INFO\",\"message\":\"Hello, world!\",\"logger\":\"my.logger\",\"properties\":{\"key\":\"value\"}}\n * ```\n *\n * You can customize the output by passing options to\n * {@link getJsonLinesFormatter}. For example, you can change the category\n * separator, the message format, and how the properties are formatted.\n *\n * [JSON Lines]: https://jsonlines.org/\n * @since 0.11.0\n */\nexport const jsonLinesFormatter: TextFormatter = getJsonLinesFormatter();\n\n/**\n * Options for the {@link getLogfmtFormatter} function.\n * @since 2.1.0\n */\nexport interface LogfmtFormatterOptions {\n /**\n * The separator between category names. For example, if the separator is\n * `\".\"`, the category `[\"a\", \"b\", \"c\"]` will be formatted as `\"a.b.c\"`.\n * If this is a function, it will be called with the category array and\n * should return a string, which will be used for rendering the category.\n *\n * @default `\".\"`\n */\n readonly categorySeparator?:\n | string\n | ((category: readonly string[]) => string);\n\n /**\n * The message format. This can be one of the following:\n *\n * - `\"template\"`: The raw message template is used as the message.\n * - `\"rendered\"`: The message is rendered with the values.\n *\n * @default `\"rendered\"`\n */\n readonly message?: \"template\" | \"rendered\";\n\n /**\n * The properties format. This can be one of the following:\n *\n * - `\"flatten\"`: The properties are flattened into logfmt key-value pairs.\n * - `\"prepend:<prefix>\"`: The properties are prepended with the given prefix\n * (e.g., `\"prepend:ctx_\"` will prepend `ctx_` to each property key).\n *\n * @default `\"flatten\"`\n */\n readonly properties?: \"flatten\" | `prepend:${string}`;\n\n /**\n * The timezone used for timestamp rendering.\n *\n * - `undefined` (default): UTC\n * - `null`: System local timezone\n * - IANA timezone name such as `\"America/Bogota\"` or `\"Asia/Seoul\"`\n * - Fixed UTC offset string such as `\"+09:00\"` or `\"-05:00\"`\n *\n * @since 2.1.0\n */\n readonly timeZone?: string | null;\n\n /**\n * Line ending style for formatted output.\n *\n * - `\"lf\"`: Unix-style line endings (`\\n`)\n * - `\"crlf\"`: Windows-style line endings (`\\r\\n`)\n *\n * @default \"lf\"\n * @since 2.1.0\n */\n readonly lineEnding?: \"lf\" | \"crlf\";\n}\n\nfunction renderStructuredMessage(record: LogRecord, template: boolean): string {\n if (template) {\n if (typeof record.rawMessage === \"string\") return record.rawMessage;\n return record.rawMessage.join(\"{}\");\n }\n\n return renderMessageParts(record.message, stringifyLogfmtValue);\n}\n\nfunction filterLogfmtKey(key: string): string | null {\n if (key === \"\") return null;\n\n let needsEscape: boolean = false;\n for (const char of key) {\n const code: number = char.codePointAt(0)!;\n if (shouldEscapeLogfmtKeyChar(char, code)) {\n needsEscape = true;\n break;\n }\n }\n if (!needsEscape) return key;\n\n let result: string = \"\";\n for (const char of key) {\n const code: number = char.codePointAt(0)!;\n if (shouldEscapeLogfmtKeyChar(char, code)) {\n result += encodeLogfmtKeyChar(char);\n } else {\n result += char;\n }\n }\n return result;\n}\n\nfunction shouldEscapeLogfmtKeyChar(char: string, code: number): boolean {\n return code <= 0x20 || code === 0x7f || code === 0xfffd ||\n char === \"=\" || char === '\"' || char === \"%\";\n}\n\nfunction encodeLogfmtKeyChar(char: string): string {\n let result: string = \"\";\n for (const byte of utf8Encoder.encode(char)) {\n result += `%${byte.toString(16).toUpperCase().padStart(2, \"0\")}`;\n }\n return result;\n}\n\nfunction stringifyLogfmtValue(value: unknown): string {\n if (typeof value === \"string\") return value;\n if (value === null) return \"null\";\n if (\n typeof value === \"number\" || typeof value === \"boolean\" ||\n typeof value === \"bigint\" || typeof value === \"undefined\" ||\n typeof value === \"symbol\" || typeof value === \"function\"\n ) {\n return String(value);\n }\n\n try {\n const json: string | undefined = JSON.stringify(value, jsonReplacer);\n if (typeof json === \"string\") return unwrapJsonStringLiteral(json);\n } catch {\n // Fall back to inspect below.\n }\n\n return inspect(value, { colors: false });\n}\n\nfunction unwrapJsonStringLiteral(json: string): string {\n if (json.startsWith('\"') && json.endsWith('\"')) {\n return JSON.parse(json) as string;\n }\n return json;\n}\n\nfunction quoteLogfmtValue(value: string, isString: boolean): string {\n let needsQuote: boolean = value === \"\" ||\n isString && shouldQuoteStringLiteral(value);\n\n for (const char of value) {\n const code: number = char.codePointAt(0)!;\n if (shouldQuoteLogfmtValueChar(char, code)) {\n needsQuote = true;\n break;\n }\n }\n if (!needsQuote) return value;\n\n let quoted: string = \"\";\n for (const char of value) {\n const code: number = char.codePointAt(0)!;\n quoted += escapeLogfmtValueChar(char, code);\n }\n return `\"${quoted}\"`;\n}\n\nfunction shouldQuoteStringLiteral(value: string): boolean {\n return value === \"null\" || value === \"undefined\" || value === \"true\" ||\n value === \"false\";\n}\n\nfunction shouldQuoteLogfmtValueChar(char: string, code: number): boolean {\n return code <= 0x20 || code === 0x7f || code === 0xfffd ||\n char === \"=\" || char === '\"' || char === \"\\\\\";\n}\n\nfunction escapeLogfmtValueChar(char: string, code: number): string {\n switch (char) {\n case \"\\t\":\n return \"\\\\t\";\n case \"\\n\":\n return \"\\\\n\";\n case \"\\r\":\n return \"\\\\r\";\n case '\"':\n return '\\\\\"';\n case \"\\\\\":\n return \"\\\\\\\\\";\n default:\n return code <= 0x1f || code === 0x7f\n ? `\\\\u${code.toString(16).padStart(4, \"0\")}`\n : char;\n }\n}\n\nfunction formatLogfmtValue(value: unknown): string {\n const stringified = stringifyLogfmtValue(value);\n return quoteLogfmtValue(stringified, typeof value === \"string\");\n}\n\nfunction pushLogfmtPair(\n pairs: string[],\n key: string,\n value: unknown,\n): void {\n const filteredKey = filterLogfmtKey(key);\n if (filteredKey == null) return;\n pairs.push(`${filteredKey}=${formatLogfmtValue(value)}`);\n}\n\n/**\n * Get a [logfmt] formatter with the specified options. The log records\n * will be rendered as space-delimited key-value pairs, one record per line.\n * It looks like this:\n *\n * ```text\n * time=2023-11-14T22:13:20.000Z level=info logger=my.logger msg=\"Hello, world!\" key=value\n * ```\n *\n * [logfmt]: https://brandur.org/logfmt\n * @param options The options for the logfmt formatter.\n * @returns The logfmt formatter.\n * @since 2.1.0\n */\nexport function getLogfmtFormatter(\n options: LogfmtFormatterOptions = {},\n): TextFormatter {\n const prependPrefix: string = \"prepend:\";\n const lineEnding: string = getLineEndingValue(options.lineEnding);\n const timestampRenderer: (ts: number) => string | null =\n createTimestampFormatter(\n \"rfc3339\",\n resolveTimeZone(options.timeZone),\n );\n const isTemplateMessage: boolean = options.message === \"template\";\n const propertiesOption: \"flatten\" | `prepend:${string}` =\n options.properties ?? \"flatten\";\n\n let joinCategory: (category: readonly string[]) => string;\n if (typeof options.categorySeparator === \"function\") {\n joinCategory = options.categorySeparator;\n } else {\n const separator = options.categorySeparator ?? \".\";\n joinCategory = (category: readonly string[]): string =>\n category.join(separator);\n }\n\n let propertyPrefix: string = \"\";\n if (propertiesOption === \"flatten\") {\n propertyPrefix = \"\";\n } else if (propertiesOption.startsWith(prependPrefix)) {\n propertyPrefix = propertiesOption.substring(prependPrefix.length);\n if (propertyPrefix === \"\") {\n throw new TypeError(\n \"Invalid properties option: \" + JSON.stringify(propertiesOption) +\n \". \" +\n 'It must be of the form \"prepend:<prefix>\" where <prefix> is a ' +\n \"non-empty string.\",\n );\n }\n } else {\n throw new TypeError(\n `Invalid properties option: ${\n JSON.stringify(propertiesOption)\n }. It must be \"flatten\" or \"prepend:<prefix>\".`,\n );\n }\n\n return (record: LogRecord): string => {\n const pairs: string[] = [];\n pushLogfmtPair(pairs, \"time\", timestampRenderer(record.timestamp));\n pushLogfmtPair(pairs, \"level\", record.level);\n pushLogfmtPair(pairs, \"logger\", joinCategory(record.category));\n pushLogfmtPair(\n pairs,\n \"msg\",\n renderStructuredMessage(\n record,\n isTemplateMessage,\n ),\n );\n\n for (const key in record.properties) {\n if (Object.prototype.hasOwnProperty.call(record.properties, key)) {\n pushLogfmtPair(\n pairs,\n `${propertyPrefix}${key}`,\n record.properties[key],\n );\n }\n }\n\n return `${pairs.join(\" \")}${lineEnding}`;\n };\n}\n\n/**\n * The default [logfmt] formatter. This formatter formats log records as\n * space-delimited key-value pairs, one record per line.\n *\n * [logfmt]: https://brandur.org/logfmt\n * @since 2.1.0\n */\nexport const logfmtFormatter: TextFormatter = getLogfmtFormatter();\n\n/**\n * A console formatter is a function that accepts a log record and returns\n * an array of arguments to pass to {@link console.log}.\n *\n * @param record The log record to format.\n * @returns The formatted log record, as an array of arguments for\n * {@link console.log}.\n */\nexport type ConsoleFormatter = (record: LogRecord) => readonly unknown[];\n\n/**\n * The styles for the log level in the console.\n */\nconst logLevelStyles: Record<LogLevel, string> = {\n \"trace\": \"background-color: gray; color: white;\",\n \"debug\": \"background-color: gray; color: white;\",\n \"info\": \"background-color: white; color: black;\",\n \"warning\": \"background-color: orange; color: black;\",\n \"error\": \"background-color: red; color: white;\",\n \"fatal\": \"background-color: maroon; color: white;\",\n};\n\n/**\n * The default console formatter.\n *\n * @param record The log record to format.\n * @returns The formatted log record, as an array of arguments for\n * {@link console.log}.\n */\nexport function defaultConsoleFormatter(record: LogRecord): readonly unknown[] {\n let msg = \"\";\n const values: unknown[] = [];\n for (let i = 0; i < record.message.length; i++) {\n if (i % 2 === 0) msg += record.message[i];\n else {\n msg += \"%o\";\n values.push(record.message[i]);\n }\n }\n const date = new Date(record.timestamp);\n const time = `${date.getUTCHours().toString().padStart(2, \"0\")}:${\n date.getUTCMinutes().toString().padStart(2, \"0\")\n }:${date.getUTCSeconds().toString().padStart(2, \"0\")}.${\n date.getUTCMilliseconds().toString().padStart(3, \"0\")\n }`;\n return [\n `%c${time} %c${levelAbbreviations[record.level]}%c %c${\n record.category.join(\"\\xb7\")\n } %c${msg}`,\n \"color: gray;\",\n logLevelStyles[record.level],\n \"background-color: default;\",\n \"color: gray;\",\n \"color: default;\",\n ...values,\n ];\n}\n"],"mappings":";;;;;;AAgBA,MAAMA,qBAA+C;CACnD,SAAS;CACT,SAAS;CACT,QAAQ;CACR,WAAW;CACX,SAAS;CACT,SAAS;AACV;;;;;;;;;;;AAYD,MAAMC,yBAMG,aAAa,sBAGX,cAAc,eAAe,UAAU,YAAY,gBACxD,CAAC,MAAM,KAAK,UAAU,EAAE,GAGxB,UAAU,cAAc,aAAa,WAAW,eAGvC,WAAW,KAAK,YAAY,aACrC,CAAC,GAAG,SAGJ,WAAW,KAAK,QAAQ,GAAG;CACzB,mBAAmB;CACnB,eAAe;CACf,GAAG;AACJ,EAAC,GAGF,QAAQ,QAAQ,aAAa,eAAe,KAAK,YAAY,aAC7D,CAAC,GAAG,SAGJ,KAAK,QAAQ,GAAG;CACd,gBAAgB;CAChB,iBAAiB;CACjB,GAAG;AACJ,EAAC,GACF,CAAC,MAAM,KAAK,UAAU,EAAE;AAE9B,MAAMC,UAAsE,CAC1EC,OACAC,YACW,OAAO,gBAAgB,OAAO,QAAQ,CAAC;AAEpD,MAAM,cAAc,IAAI;AAExB,SAAS,mBACPC,UACAC,eACQ;CACR,MAAMC,SAAiB,SAAS;AAEhC,KAAI,WAAW,EACb,QAAO,SAAS;AAGlB,KAAI,UAAU,GAAG;EACf,IAAIC,UAAkB;AACtB,OAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,IAC1B,YAAY,IAAI,MAAM,IAClB,SAAS,KACT,cAAc,SAAS,GA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