@likec4/log 1.46.1 → 1.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ //#region ../../node_modules/.pnpm/safe-stringify@1.2.0/node_modules/safe-stringify/index.js
2
+ function safeStringifyReplacer(seen) {
3
+ const replacer = function(key, value) {
4
+ if (typeof value?.toJSON === "function") value = value.toJSON();
5
+ if (!(value !== null && typeof value === "object")) return value;
6
+ if (seen.has(value)) return "[Circular]";
7
+ seen.add(value);
8
+ const newValue = Array.isArray(value) ? [] : {};
9
+ for (const [key2, value2] of Object.entries(value)) newValue[key2] = replacer(key2, value2);
10
+ seen.delete(value);
11
+ return newValue;
12
+ };
13
+ return replacer;
14
+ }
15
+ function safeStringify(object, { indentation } = {}) {
16
+ const seen = /* @__PURE__ */ new WeakSet();
17
+ return JSON.stringify(object, safeStringifyReplacer(seen), indentation);
18
+ }
19
+
20
+ //#endregion
21
+ export { safeStringify as t };
package/dist/index.d.mts CHANGED
@@ -1,18 +1,29 @@
1
- import * as _logtape_logtape from '@logtape/logtape';
2
- import { LogRecord, AnsiColorFormatterOptions, TextFormatter, ConsoleSinkOptions, Sink, TextFormatterOptions, Config } from '@logtape/logtape';
3
- export { Filter, LogLevel, LogRecord, Logger, Sink, TextFormatter, withFilter } from '@logtape/logtape';
1
+ import * as _logtape_logtape0 from "@logtape/logtape";
2
+ import { AnsiColorFormatterOptions, Config, ConsoleFormatter, ConsoleSinkOptions, Filter, LogLevel, LogRecord, LogRecord as LogRecord$1, Logger, Sink, Sink as Sink$1, TextFormatter, TextFormatter as TextFormatter$1, TextFormatterOptions, withFilter } from "@logtape/logtape";
4
3
 
5
- declare function errorFromLogRecord(record: LogRecord): Error | null;
6
- declare function getMessageOnlyFormatter(): TextFormatter;
7
- declare function getTextFormatter(options?: TextFormatterOptions): TextFormatter;
8
- declare function getAnsiColorFormatter(options?: AnsiColorFormatterOptions): TextFormatter;
9
- declare function getConsoleSink(options?: ConsoleSinkOptions): Sink;
4
+ //#region src/formatters.d.ts
5
+ declare function errorFromLogRecord(record: LogRecord$1): Error | null;
6
+ declare function getMessageOnlyFormatter(): TextFormatter$1;
7
+ declare function getTextFormatter(options?: TextFormatterOptions): TextFormatter$1;
8
+ declare function getAnsiColorFormatter(options?: AnsiColorFormatterOptions): TextFormatter$1;
9
+ /**
10
+ * The formatter returns an array where:
11
+ * - First element is the formatted message string
12
+ * - Second element is the record properties object
13
+ */
14
+ declare function getConsoleFormatter(options?: {
15
+ messageFormatter?: TextFormatter$1;
16
+ }): ConsoleFormatter;
17
+ //#endregion
18
+ //#region src/sink.d.ts
19
+ declare function getConsoleSink(options?: ConsoleSinkOptions): Sink$1;
10
20
  /**
11
21
  * Creates a console sink that writes to stderr.
12
22
  * (MCP protocol requires stderr to be used for logging)
13
23
  */
14
- declare function getConsoleStderrSink(options?: ConsoleSinkOptions): Sink;
15
-
24
+ declare function getConsoleStderrSink(options?: ConsoleSinkOptions): Sink$1;
25
+ //#endregion
26
+ //#region src/utils.d.ts
16
27
  declare function loggable(error: unknown): string;
17
28
  type NormalizeError<ErrorArg> = ErrorArg extends Error ? ErrorArg : Error;
18
29
  /**
@@ -49,16 +60,16 @@ type NormalizeError<ErrorArg> = ErrorArg extends Error ? ErrorArg : Error;
49
60
  * ```
50
61
  */
51
62
  declare function wrapError<ErrorArg>(error: ErrorArg, newMessage: string): NormalizeError<ErrorArg>;
52
-
53
- declare const logger: _logtape_logtape.Logger;
54
-
63
+ //#endregion
64
+ //#region src/index.d.ts
65
+ declare const logger: _logtape_logtape0.Logger;
55
66
  /**
56
67
  * Get a child logger with the given subcategory.
57
68
  *
58
69
  * @param subcategory The subcategory.
59
70
  * @returns The child logger.
60
71
  */
61
- declare function createLogger(subcategory: string | readonly [string] | readonly [string, ...string[]]): _logtape_logtape.Logger;
72
+ declare function createLogger(subcategory: string | readonly [string] | readonly [string, ...string[]]): _logtape_logtape0.Logger;
62
73
  declare function configureLogger<TSinkId extends string, TFilterId extends string>(config?: Partial<Config<TSinkId, TFilterId>>): void;
63
-
64
- export { configureLogger, logger as consola, createLogger, errorFromLogRecord, getAnsiColorFormatter, getConsoleSink, getConsoleStderrSink, getMessageOnlyFormatter, getTextFormatter, loggable, logger, logger as rootLogger, wrapError };
74
+ //#endregion
75
+ export { type Filter, type LogLevel, type LogRecord, type Logger, type Sink, type TextFormatter, configureLogger, logger as consola, logger, logger as rootLogger, createLogger, errorFromLogRecord, getAnsiColorFormatter, getConsoleFormatter, getConsoleSink, getConsoleStderrSink, getMessageOnlyFormatter, getTextFormatter, loggable, withFilter, wrapError };