likec4 1.56.0 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__app__/codegen/react.mjs +7 -8
- package/__app__/codegen/webcomponent.mjs +77 -736
- package/__app__/src/aichat/index.mjs +8 -0
- package/__app__/src/chunks/AIChat.mjs +959 -0
- package/__app__/src/chunks/DiagramActorProvider.mjs +7638 -0
- package/__app__/src/chunks/LikeC4Styles.mjs +1866 -0
- package/__app__/src/chunks/Markdown.mjs +146 -0
- package/__app__/src/chunks/NavigationPanel.mjs +61 -0
- package/__app__/src/chunks/ProjectsOverview.mjs +540 -0
- package/__app__/src/chunks/adhoc-editor.mjs +3386 -0
- package/__app__/src/chunks/es.mjs +439 -0
- package/__app__/src/chunks/hooks.mjs +145 -0
- package/__app__/src/chunks/libs/@dagrejs/dagre.mjs +1894 -0
- package/__app__/src/chunks/libs/@floating-ui.mjs +2218 -0
- package/__app__/src/chunks/libs/@mantine.mjs +12070 -0
- package/__app__/src/chunks/libs/@tabler/icons-react.mjs +252 -0
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +1768 -0
- package/__app__/src/chunks/libs/@tanstack.mjs +2718 -0
- package/__app__/src/chunks/libs/@xstate/react.mjs +1982 -0
- package/__app__/src/chunks/libs/@xyflow/react.mjs +5256 -0
- package/__app__/src/chunks/libs/bezier-js.mjs +1003 -0
- package/__app__/src/chunks/libs/d3.mjs +2842 -0
- package/__app__/src/chunks/libs/fast-equals.mjs +268 -0
- package/__app__/src/chunks/libs/framer.mjs +5872 -0
- package/__app__/src/chunks/libs/remeda.mjs +642 -0
- package/__app__/src/chunks/libs/zod.mjs +3170 -0
- package/__app__/src/chunks/rolldown-runtime.mjs +23 -0
- package/__app__/src/chunks/styled-system.mjs +1040 -0
- package/__app__/src/fonts.css +1 -1
- package/__app__/src/main.mjs +14847 -1
- package/__app__/src/style.css +1 -1
- package/config/schema.json +14 -41
- package/dist/chunks/enableServer.mjs +1 -0
- package/dist/chunks/filenames.mjs +2 -2
- package/dist/chunks/index2.d.mts +2057 -722
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -1
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -3
- package/dist/chunks/libs/@ts-graphviz/ast.mjs +3 -0
- package/dist/chunks/libs/@ts-graphviz/common.d.mts +9 -0
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -0
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +26 -26
- package/dist/chunks/libs/langium.d.mts +5 -5
- package/dist/chunks/libs/langium.mjs +10 -10
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/pako.mjs +3 -1
- package/dist/chunks/libs/pretty-ms.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ufo.mjs +1 -1
- package/dist/chunks/libs/unstorage.mjs +1 -1
- package/dist/chunks/libs/which.mjs +1 -1
- package/dist/chunks/libs/zod.d.mts +60 -25
- package/dist/chunks/libs/zod.mjs +65 -0
- package/dist/chunks/node.mjs +84 -56
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/chunks/vite-plugin.mjs +593 -0
- package/dist/cli/index.mjs +184 -141
- package/dist/index.d.mts +2 -131
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +2 -2
- package/dist/vite-plugin/index.d.mts +53 -2
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/index.d.mts +327 -4
- package/dist/vite-plugin/internal/index.mjs +946 -1
- package/package.json +85 -72
- package/react/index.d.mts +174 -73
- package/react/index.mjs +42468 -38926
- package/vite-plugin-modules.d.ts +4 -0
- package/__app__/chunks/ColorSchemeToggle.mjs +0 -1
- package/__app__/chunks/DiagramActorProvider.mjs +0 -10
- package/__app__/chunks/Fallback.mjs +0 -1
- package/__app__/chunks/Header.mjs +0 -13
- package/__app__/chunks/IconRenderer.mjs +0 -1
- package/__app__/chunks/LikeC4Diagram.mjs +0 -19
- package/__app__/chunks/LikeC4ModelContext.mjs +0 -1
- package/__app__/chunks/LikeC4ModelContext2.mjs +0 -1
- package/__app__/chunks/LikeC4Styles.mjs +0 -48
- package/__app__/chunks/NavigationPanel.mjs +0 -1
- package/__app__/chunks/StaticLikeC4Diagram.mjs +0 -1
- package/__app__/chunks/ViewReact.mjs +0 -1
- package/__app__/chunks/__root.mjs +0 -1
- package/__app__/chunks/adhoc-editor.mjs +0 -1
- package/__app__/chunks/hooks.mjs +0 -1
- package/__app__/chunks/libs/@dagrejs/dagre.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/core.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/dom.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/react.mjs +0 -1
- package/__app__/chunks/libs/@mantine/core.mjs +0 -41
- package/__app__/chunks/libs/@mantine/hooks.mjs +0 -1
- package/__app__/chunks/libs/@nanostores/react.mjs +0 -1
- package/__app__/chunks/libs/@react-hookz/web.mjs +0 -1
- package/__app__/chunks/libs/@tabler/icons-react.mjs +0 -15
- package/__app__/chunks/libs/@tanstack/history.mjs +0 -1
- package/__app__/chunks/libs/@tanstack/react-router.mjs +0 -3
- package/__app__/chunks/libs/@tanstack/router-core.mjs +0 -1
- package/__app__/chunks/libs/@xstate/react.mjs +0 -1
- package/__app__/chunks/libs/@xstate/store.mjs +0 -1
- package/__app__/chunks/libs/@xyflow/react.mjs +0 -7
- package/__app__/chunks/libs/@zag-js/anatomy.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/collection.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/core.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/react.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/tree-view.mjs +0 -1
- package/__app__/chunks/libs/bezier-js.mjs +0 -1
- package/__app__/chunks/libs/d3-path.mjs +0 -1
- package/__app__/chunks/libs/d3-shape.mjs +0 -1
- package/__app__/chunks/libs/fast-equals.mjs +0 -1
- package/__app__/chunks/libs/framer-motion.mjs +0 -9
- package/__app__/chunks/libs/html-to-image.mjs +0 -2
- package/__app__/chunks/libs/motion-dom.mjs +0 -1
- package/__app__/chunks/libs/motion.mjs +0 -1
- package/__app__/chunks/libs/nanostores.mjs +0 -1
- package/__app__/chunks/libs/react-error-boundary.mjs +0 -1
- package/__app__/chunks/libs/react-resizable-panels.mjs +0 -1
- package/__app__/chunks/libs/remeda.mjs +0 -1
- package/__app__/chunks/libs/xstate.mjs +0 -1
- package/__app__/chunks/libs/zod.mjs +0 -39
- package/__app__/chunks/rolldown-runtime.mjs +0 -1
- package/__app__/chunks/safeCtx.mjs +0 -1
- package/__app__/chunks/searchParams.mjs +0 -1
- package/__app__/chunks/single-index.mjs +0 -1
- package/__app__/chunks/styled-system.mjs +0 -1
- package/__app__/chunks/styles.css.mjs +0 -1
- package/__app__/chunks/useLikeC4Project.mjs +0 -1
- package/__app__/chunks/useUpdateEffect.mjs +0 -1
- package/__app__/src/pages/AdHocViewEditor.mjs +0 -1
- package/__app__/src/pages/EmbedPage.mjs +0 -1
- package/__app__/src/pages/ExportPage.mjs +0 -1
- package/__app__/src/pages/ProjectsOverview.mjs +0 -1
- package/__app__/src/pages/ViewAsD2.mjs +0 -1
- package/__app__/src/pages/ViewAsDot.mjs +0 -1
- package/__app__/src/pages/ViewAsMmd.mjs +0 -1
- package/__app__/src/pages/ViewAsPuml.mjs +0 -1
- package/__app__/src/pages/ViewEditor.mjs +0 -1
- package/__app__/src/pages/ViewReact.mjs +0 -1
- package/__app__/src/routeTree.gen.mjs +0 -1
- package/__app__/src/routes/__root.mjs +0 -1
- package/__app__/src/routes/_single/adhoc.mjs +0 -1
- package/__app__/src/routes/_single/embed._viewId.mjs +0 -1
- package/__app__/src/routes/_single/export._viewId.mjs +0 -1
- package/__app__/src/routes/_single/route.mjs +0 -1
- package/__app__/src/routes/_single/single-index.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.d2.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.dot.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.index.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.mmd.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.puml.mjs +0 -1
- package/__app__/src/routes/_single/webcomponent._.mjs +0 -33
- package/__app__/src/routes/index.mjs +0 -1
- package/__app__/src/routes/project._projectId/-components.mjs +0 -1
- package/__app__/src/routes/project._projectId/adhoc.mjs +0 -1
- package/__app__/src/routes/project._projectId/embed._viewId.mjs +0 -1
- package/__app__/src/routes/project._projectId/export._viewId.mjs +0 -1
- package/__app__/src/routes/project._projectId/index.mjs +0 -1
- package/__app__/src/routes/project._projectId/route.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.index.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +0 -1
- package/__app__/src/routes/projects.mjs +0 -1
- package/dist/chunks/libs/@chevrotain/utils.mjs +0 -1
- package/dist/chunks/libs/@hono/mcp.mjs +0 -45
- package/dist/chunks/libs/@hono/node-server.mjs +0 -1
- package/dist/chunks/libs/@logtape/logtape.d.mts +0 -1023
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
- package/dist/chunks/libs/ajv.mjs +0 -1
- package/dist/chunks/libs/ansi-align.mjs +0 -2
- package/dist/chunks/libs/ansi-regex.mjs +0 -1
- package/dist/chunks/libs/ansi-styles.mjs +0 -1
- package/dist/chunks/libs/atomically.mjs +0 -1
- package/dist/chunks/libs/boxen.mjs +0 -22
- package/dist/chunks/libs/conf.mjs +0 -1
- package/dist/chunks/libs/defu.mjs +0 -1
- package/dist/chunks/libs/destr.mjs +0 -1
- package/dist/chunks/libs/find-up-simple.mjs +0 -1
- package/dist/chunks/libs/get-port.mjs +0 -1
- package/dist/chunks/libs/hono.mjs +0 -1
- package/dist/chunks/libs/is-docker.mjs +0 -1
- package/dist/chunks/libs/is-error-instance.mjs +0 -1
- package/dist/chunks/libs/is-inside-container.mjs +0 -1
- package/dist/chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/chunks/libs/isexe.mjs +0 -1
- package/dist/chunks/libs/ky.mjs +0 -3
- package/dist/chunks/libs/p-debounce.mjs +0 -1
- package/dist/chunks/libs/p-limit.mjs +0 -1
- package/dist/chunks/libs/p-timeout.mjs +0 -1
- package/dist/chunks/libs/package-up.mjs +0 -1
- package/dist/chunks/libs/parse-ms.mjs +0 -1
- package/dist/chunks/libs/safe-stringify.mjs +0 -1
- package/dist/chunks/libs/strip-indent.mjs +0 -1
- package/dist/chunks/libs/tinyrainbow.mjs +0 -1
- package/dist/chunks/libs/ts-graphviz.d.mts +0 -12
- package/dist/chunks/libs/ts-graphviz.mjs +0 -4
- package/dist/chunks/libs/vscode-languageserver.mjs +0 -1
- package/dist/chunks/libs/word-wrap.mjs +0 -12
- package/dist/chunks/plugin.mjs +0 -400
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.d.mts +0 -269
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +0 -59
- package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +0 -1
|
@@ -1,1023 +0,0 @@
|
|
|
1
|
-
import { i as __name } from "../../rolldown-runtime.mjs";
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/@logtape+logtape@2.0.5/node_modules/@logtape/logtape/dist/level.d.ts
|
|
4
|
-
//#region src/level.d.ts
|
|
5
|
-
declare const logLevels: readonly ["trace", "debug", "info", "warning", "error", "fatal"];
|
|
6
|
-
/**
|
|
7
|
-
* The severity level of a {@link LogRecord}.
|
|
8
|
-
*/
|
|
9
|
-
type LogLevel = typeof logLevels[number];
|
|
10
|
-
/**
|
|
11
|
-
* Lists all available log levels with the order of their severity.
|
|
12
|
-
* The `"trace"` level goes first, and the `"fatal"` level goes last.
|
|
13
|
-
* @returns A new copy of the array of log levels.
|
|
14
|
-
* @since 1.0.0
|
|
15
|
-
*/
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region ../../node_modules/.pnpm/@logtape+logtape@2.0.5/node_modules/@logtape/logtape/dist/record.d.ts
|
|
18
|
-
//#region src/record.d.ts
|
|
19
|
-
/**
|
|
20
|
-
* A log record.
|
|
21
|
-
*/
|
|
22
|
-
interface LogRecord {
|
|
23
|
-
/**
|
|
24
|
-
* The category of the logger that produced the log record.
|
|
25
|
-
*/
|
|
26
|
-
readonly category: readonly string[];
|
|
27
|
-
/**
|
|
28
|
-
* The log level.
|
|
29
|
-
*/
|
|
30
|
-
readonly level: LogLevel;
|
|
31
|
-
/**
|
|
32
|
-
* The log message. This is the result of substituting the message template
|
|
33
|
-
* with the values. The number of elements in this array is always odd,
|
|
34
|
-
* with the message template values interleaved between the substitution
|
|
35
|
-
* values.
|
|
36
|
-
*/
|
|
37
|
-
readonly message: readonly unknown[];
|
|
38
|
-
/**
|
|
39
|
-
* The raw log message. This is the original message template without any
|
|
40
|
-
* further processing. It can be either:
|
|
41
|
-
*
|
|
42
|
-
* - A string without any substitutions if the log record was created with
|
|
43
|
-
* a method call syntax, e.g., "Hello, {name}!" for
|
|
44
|
-
* `logger.info("Hello, {name}!", { name })`.
|
|
45
|
-
* - A template string array if the log record was created with a tagged
|
|
46
|
-
* template literal syntax, e.g., `["Hello, ", "!"]` for
|
|
47
|
-
* ``logger.info`Hello, ${name}!```.
|
|
48
|
-
*
|
|
49
|
-
* @since 0.6.0
|
|
50
|
-
*/
|
|
51
|
-
readonly rawMessage: string | TemplateStringsArray;
|
|
52
|
-
/**
|
|
53
|
-
* The timestamp of the log record in milliseconds since the Unix epoch.
|
|
54
|
-
*/
|
|
55
|
-
readonly timestamp: number;
|
|
56
|
-
/**
|
|
57
|
-
* The extra properties of the log record.
|
|
58
|
-
*/
|
|
59
|
-
readonly properties: Record<string, unknown>;
|
|
60
|
-
} //# sourceMappingURL=record.d.ts.map
|
|
61
|
-
//#endregion
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region ../../node_modules/.pnpm/@logtape+logtape@2.0.5/node_modules/@logtape/logtape/dist/logger.d.ts
|
|
64
|
-
/**
|
|
65
|
-
* A logger interface. It provides methods to log messages at different
|
|
66
|
-
* severity levels.
|
|
67
|
-
*
|
|
68
|
-
* ```typescript
|
|
69
|
-
* const logger = getLogger("category");
|
|
70
|
-
* logger.trace `A trace message with ${value}`
|
|
71
|
-
* logger.debug `A debug message with ${value}.`;
|
|
72
|
-
* logger.info `An info message with ${value}.`;
|
|
73
|
-
* logger.warn `A warning message with ${value}.`;
|
|
74
|
-
* logger.error `An error message with ${value}.`;
|
|
75
|
-
* logger.fatal `A fatal error message with ${value}.`;
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
interface Logger {
|
|
79
|
-
/**
|
|
80
|
-
* The category of the logger. It is an array of strings.
|
|
81
|
-
*/
|
|
82
|
-
readonly category: readonly string[];
|
|
83
|
-
/**
|
|
84
|
-
* The logger with the supercategory of the current logger. If the current
|
|
85
|
-
* logger is the root logger, this is `null`.
|
|
86
|
-
*/
|
|
87
|
-
readonly parent: Logger | null;
|
|
88
|
-
/**
|
|
89
|
-
* Get a child logger with the given subcategory.
|
|
90
|
-
*
|
|
91
|
-
* ```typescript
|
|
92
|
-
* const logger = getLogger("category");
|
|
93
|
-
* const subLogger = logger.getChild("sub-category");
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* The above code is equivalent to:
|
|
97
|
-
*
|
|
98
|
-
* ```typescript
|
|
99
|
-
* const logger = getLogger("category");
|
|
100
|
-
* const subLogger = getLogger(["category", "sub-category"]);
|
|
101
|
-
* ```
|
|
102
|
-
*
|
|
103
|
-
* @param subcategory The subcategory.
|
|
104
|
-
* @returns The child logger.
|
|
105
|
-
*/
|
|
106
|
-
getChild(subcategory: string | readonly [string] | readonly [string, ...string[]]): Logger;
|
|
107
|
-
/**
|
|
108
|
-
* Get a logger with contextual properties. This is useful for
|
|
109
|
-
* log multiple messages with the shared set of properties.
|
|
110
|
-
*
|
|
111
|
-
* ```typescript
|
|
112
|
-
* const logger = getLogger("category");
|
|
113
|
-
* const ctx = logger.with({ foo: 123, bar: "abc" });
|
|
114
|
-
* ctx.info("A message with {foo} and {bar}.");
|
|
115
|
-
* ctx.warn("Another message with {foo}, {bar}, and {baz}.", { baz: true });
|
|
116
|
-
* ```
|
|
117
|
-
*
|
|
118
|
-
* The above code is equivalent to:
|
|
119
|
-
*
|
|
120
|
-
* ```typescript
|
|
121
|
-
* const logger = getLogger("category");
|
|
122
|
-
* logger.info("A message with {foo} and {bar}.", { foo: 123, bar: "abc" });
|
|
123
|
-
* logger.warn(
|
|
124
|
-
* "Another message with {foo}, {bar}, and {baz}.",
|
|
125
|
-
* { foo: 123, bar: "abc", baz: true },
|
|
126
|
-
* );
|
|
127
|
-
* ```
|
|
128
|
-
*
|
|
129
|
-
* @param properties
|
|
130
|
-
* @returns
|
|
131
|
-
* @since 0.5.0
|
|
132
|
-
*/
|
|
133
|
-
with(properties: Record<string, unknown>): Logger;
|
|
134
|
-
/**
|
|
135
|
-
* Log a trace message. Use this as a template string prefix.
|
|
136
|
-
*
|
|
137
|
-
* ```typescript
|
|
138
|
-
* logger.trace `A trace message with ${value}.`;
|
|
139
|
-
* ```
|
|
140
|
-
*
|
|
141
|
-
* @param message The message template strings array.
|
|
142
|
-
* @param values The message template values.
|
|
143
|
-
* @since 0.12.0
|
|
144
|
-
*/
|
|
145
|
-
trace(message: TemplateStringsArray, ...values: readonly unknown[]): void;
|
|
146
|
-
/**
|
|
147
|
-
* Log a trace message with properties.
|
|
148
|
-
*
|
|
149
|
-
* ```typescript
|
|
150
|
-
* logger.trace('A trace message with {value}.', { value });
|
|
151
|
-
* ```
|
|
152
|
-
*
|
|
153
|
-
* If the properties are expensive to compute, you can pass a callback that
|
|
154
|
-
* returns the properties:
|
|
155
|
-
*
|
|
156
|
-
* ```typescript
|
|
157
|
-
* logger.trace(
|
|
158
|
-
* 'A trace message with {value}.',
|
|
159
|
-
* () => ({ value: expensiveComputation() })
|
|
160
|
-
* );
|
|
161
|
-
* ```
|
|
162
|
-
*
|
|
163
|
-
* @param message The message template. Placeholders to be replaced with
|
|
164
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
165
|
-
* `{value}`).
|
|
166
|
-
* @param properties The values to replace placeholders with. For lazy
|
|
167
|
-
* evaluation, this can be a callback that returns the
|
|
168
|
-
* properties.
|
|
169
|
-
* @since 0.12.0
|
|
170
|
-
*/
|
|
171
|
-
trace(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
172
|
-
/**
|
|
173
|
-
* Log a trace message with properties computed asynchronously.
|
|
174
|
-
*
|
|
175
|
-
* Use this when the properties require async operations to compute:
|
|
176
|
-
*
|
|
177
|
-
* ```typescript
|
|
178
|
-
* await logger.trace(
|
|
179
|
-
* 'A trace message with {value}.',
|
|
180
|
-
* async () => ({ value: await fetchValue() })
|
|
181
|
-
* );
|
|
182
|
-
* ```
|
|
183
|
-
*
|
|
184
|
-
* @param message The message template. Placeholders to be replaced with
|
|
185
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
186
|
-
* `{value}`).
|
|
187
|
-
* @param properties An async callback that returns the properties.
|
|
188
|
-
* @returns A promise that resolves when the log is written.
|
|
189
|
-
* @since 2.0.0
|
|
190
|
-
*/
|
|
191
|
-
trace(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
|
|
192
|
-
/**
|
|
193
|
-
* Log a trace values with no message. This is useful when you
|
|
194
|
-
* want to log properties without a message, e.g., when you want to log
|
|
195
|
-
* the context of a request or an operation.
|
|
196
|
-
*
|
|
197
|
-
* ```typescript
|
|
198
|
-
* logger.trace({ method: 'GET', url: '/api/v1/resource' });
|
|
199
|
-
* ```
|
|
200
|
-
*
|
|
201
|
-
* Note that this is a shorthand for:
|
|
202
|
-
*
|
|
203
|
-
* ```typescript
|
|
204
|
-
* logger.trace('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
205
|
-
* ```
|
|
206
|
-
*
|
|
207
|
-
* If the properties are expensive to compute, you cannot use this shorthand
|
|
208
|
-
* and should use the following syntax instead:
|
|
209
|
-
*
|
|
210
|
-
* ```typescript
|
|
211
|
-
* logger.trace('{*}', () => ({
|
|
212
|
-
* method: expensiveMethod(),
|
|
213
|
-
* url: expensiveUrl(),
|
|
214
|
-
* }));
|
|
215
|
-
* ```
|
|
216
|
-
*
|
|
217
|
-
* @param properties The values to log. Note that this does not take
|
|
218
|
-
* a callback.
|
|
219
|
-
* @since 0.12.0
|
|
220
|
-
*/
|
|
221
|
-
trace(properties: Record<string, unknown>): void;
|
|
222
|
-
/**
|
|
223
|
-
* Lazily log a trace message. Use this when the message values are expensive
|
|
224
|
-
* to compute and should only be computed if the message is actually logged.
|
|
225
|
-
*
|
|
226
|
-
* ```typescript
|
|
227
|
-
* logger.trace(l => l`A trace message with ${expensiveValue()}.`);
|
|
228
|
-
* ```
|
|
229
|
-
*
|
|
230
|
-
* @param callback A callback that returns the message template prefix.
|
|
231
|
-
* @throws {TypeError} If no log record was made inside the callback.
|
|
232
|
-
* @since 0.12.0
|
|
233
|
-
*/
|
|
234
|
-
trace(callback: LogCallback): void;
|
|
235
|
-
/**
|
|
236
|
-
* Log a debug message. Use this as a template string prefix.
|
|
237
|
-
*
|
|
238
|
-
* ```typescript
|
|
239
|
-
* logger.debug `A debug message with ${value}.`;
|
|
240
|
-
* ```
|
|
241
|
-
*
|
|
242
|
-
* @param message The message template strings array.
|
|
243
|
-
* @param values The message template values.
|
|
244
|
-
*/
|
|
245
|
-
debug(message: TemplateStringsArray, ...values: readonly unknown[]): void;
|
|
246
|
-
/**
|
|
247
|
-
* Log a debug message with properties.
|
|
248
|
-
*
|
|
249
|
-
* ```typescript
|
|
250
|
-
* logger.debug('A debug message with {value}.', { value });
|
|
251
|
-
* ```
|
|
252
|
-
*
|
|
253
|
-
* If the properties are expensive to compute, you can pass a callback that
|
|
254
|
-
* returns the properties:
|
|
255
|
-
*
|
|
256
|
-
* ```typescript
|
|
257
|
-
* logger.debug(
|
|
258
|
-
* 'A debug message with {value}.',
|
|
259
|
-
* () => ({ value: expensiveComputation() })
|
|
260
|
-
* );
|
|
261
|
-
* ```
|
|
262
|
-
*
|
|
263
|
-
* @param message The message template. Placeholders to be replaced with
|
|
264
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
265
|
-
* `{value}`).
|
|
266
|
-
* @param properties The values to replace placeholders with. For lazy
|
|
267
|
-
* evaluation, this can be a callback that returns the
|
|
268
|
-
* properties.
|
|
269
|
-
*/
|
|
270
|
-
debug(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
271
|
-
/**
|
|
272
|
-
* Log a debug message with properties computed asynchronously.
|
|
273
|
-
*
|
|
274
|
-
* Use this when the properties require async operations to compute:
|
|
275
|
-
*
|
|
276
|
-
* ```typescript
|
|
277
|
-
* await logger.debug(
|
|
278
|
-
* 'A debug message with {value}.',
|
|
279
|
-
* async () => ({ value: await fetchValue() })
|
|
280
|
-
* );
|
|
281
|
-
* ```
|
|
282
|
-
*
|
|
283
|
-
* @param message The message template. Placeholders to be replaced with
|
|
284
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
285
|
-
* `{value}`).
|
|
286
|
-
* @param properties An async callback that returns the properties.
|
|
287
|
-
* @returns A promise that resolves when the log is written.
|
|
288
|
-
* @since 2.0.0
|
|
289
|
-
*/
|
|
290
|
-
debug(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
|
|
291
|
-
/**
|
|
292
|
-
* Log a debug values with no message. This is useful when you
|
|
293
|
-
* want to log properties without a message, e.g., when you want to log
|
|
294
|
-
* the context of a request or an operation.
|
|
295
|
-
*
|
|
296
|
-
* ```typescript
|
|
297
|
-
* logger.debug({ method: 'GET', url: '/api/v1/resource' });
|
|
298
|
-
* ```
|
|
299
|
-
*
|
|
300
|
-
* Note that this is a shorthand for:
|
|
301
|
-
*
|
|
302
|
-
* ```typescript
|
|
303
|
-
* logger.debug('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
304
|
-
* ```
|
|
305
|
-
*
|
|
306
|
-
* If the properties are expensive to compute, you cannot use this shorthand
|
|
307
|
-
* and should use the following syntax instead:
|
|
308
|
-
*
|
|
309
|
-
* ```typescript
|
|
310
|
-
* logger.debug('{*}', () => ({
|
|
311
|
-
* method: expensiveMethod(),
|
|
312
|
-
* url: expensiveUrl(),
|
|
313
|
-
* }));
|
|
314
|
-
* ```
|
|
315
|
-
*
|
|
316
|
-
* @param properties The values to log. Note that this does not take
|
|
317
|
-
* a callback.
|
|
318
|
-
* @since 0.11.0
|
|
319
|
-
*/
|
|
320
|
-
debug(properties: Record<string, unknown>): void;
|
|
321
|
-
/**
|
|
322
|
-
* Lazily log a debug message. Use this when the message values are expensive
|
|
323
|
-
* to compute and should only be computed if the message is actually logged.
|
|
324
|
-
*
|
|
325
|
-
* ```typescript
|
|
326
|
-
* logger.debug(l => l`A debug message with ${expensiveValue()}.`);
|
|
327
|
-
* ```
|
|
328
|
-
*
|
|
329
|
-
* @param callback A callback that returns the message template prefix.
|
|
330
|
-
* @throws {TypeError} If no log record was made inside the callback.
|
|
331
|
-
*/
|
|
332
|
-
debug(callback: LogCallback): void;
|
|
333
|
-
/**
|
|
334
|
-
* Log an informational message. Use this as a template string prefix.
|
|
335
|
-
*
|
|
336
|
-
* ```typescript
|
|
337
|
-
* logger.info `An info message with ${value}.`;
|
|
338
|
-
* ```
|
|
339
|
-
*
|
|
340
|
-
* @param message The message template strings array.
|
|
341
|
-
* @param values The message template values.
|
|
342
|
-
*/
|
|
343
|
-
info(message: TemplateStringsArray, ...values: readonly unknown[]): void;
|
|
344
|
-
/**
|
|
345
|
-
* Log an informational message with properties.
|
|
346
|
-
*
|
|
347
|
-
* ```typescript
|
|
348
|
-
* logger.info('An info message with {value}.', { value });
|
|
349
|
-
* ```
|
|
350
|
-
*
|
|
351
|
-
* If the properties are expensive to compute, you can pass a callback that
|
|
352
|
-
* returns the properties:
|
|
353
|
-
*
|
|
354
|
-
* ```typescript
|
|
355
|
-
* logger.info(
|
|
356
|
-
* 'An info message with {value}.',
|
|
357
|
-
* () => ({ value: expensiveComputation() })
|
|
358
|
-
* );
|
|
359
|
-
* ```
|
|
360
|
-
*
|
|
361
|
-
* @param message The message template. Placeholders to be replaced with
|
|
362
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
363
|
-
* `{value}`).
|
|
364
|
-
* @param properties The values to replace placeholders with. For lazy
|
|
365
|
-
* evaluation, this can be a callback that returns the
|
|
366
|
-
* properties.
|
|
367
|
-
*/
|
|
368
|
-
info(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
369
|
-
/**
|
|
370
|
-
* Log an informational message with properties computed asynchronously.
|
|
371
|
-
*
|
|
372
|
-
* Use this when the properties require async operations to compute:
|
|
373
|
-
*
|
|
374
|
-
* ```typescript
|
|
375
|
-
* await logger.info(
|
|
376
|
-
* 'An info message with {value}.',
|
|
377
|
-
* async () => ({ value: await fetchValue() })
|
|
378
|
-
* );
|
|
379
|
-
* ```
|
|
380
|
-
*
|
|
381
|
-
* @param message The message template. Placeholders to be replaced with
|
|
382
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
383
|
-
* `{value}`).
|
|
384
|
-
* @param properties An async callback that returns the properties.
|
|
385
|
-
* @returns A promise that resolves when the log is written.
|
|
386
|
-
* @since 2.0.0
|
|
387
|
-
*/
|
|
388
|
-
info(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
|
|
389
|
-
/**
|
|
390
|
-
* Log an informational values with no message. This is useful when you
|
|
391
|
-
* want to log properties without a message, e.g., when you want to log
|
|
392
|
-
* the context of a request or an operation.
|
|
393
|
-
*
|
|
394
|
-
* ```typescript
|
|
395
|
-
* logger.info({ method: 'GET', url: '/api/v1/resource' });
|
|
396
|
-
* ```
|
|
397
|
-
*
|
|
398
|
-
* Note that this is a shorthand for:
|
|
399
|
-
*
|
|
400
|
-
* ```typescript
|
|
401
|
-
* logger.info('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
402
|
-
* ```
|
|
403
|
-
*
|
|
404
|
-
* If the properties are expensive to compute, you cannot use this shorthand
|
|
405
|
-
* and should use the following syntax instead:
|
|
406
|
-
*
|
|
407
|
-
* ```typescript
|
|
408
|
-
* logger.info('{*}', () => ({
|
|
409
|
-
* method: expensiveMethod(),
|
|
410
|
-
* url: expensiveUrl(),
|
|
411
|
-
* }));
|
|
412
|
-
* ```
|
|
413
|
-
*
|
|
414
|
-
* @param properties The values to log. Note that this does not take
|
|
415
|
-
* a callback.
|
|
416
|
-
* @since 0.11.0
|
|
417
|
-
*/
|
|
418
|
-
info(properties: Record<string, unknown>): void;
|
|
419
|
-
/**
|
|
420
|
-
* Lazily log an informational message. Use this when the message values are
|
|
421
|
-
* expensive to compute and should only be computed if the message is actually
|
|
422
|
-
* logged.
|
|
423
|
-
*
|
|
424
|
-
* ```typescript
|
|
425
|
-
* logger.info(l => l`An info message with ${expensiveValue()}.`);
|
|
426
|
-
* ```
|
|
427
|
-
*
|
|
428
|
-
* @param callback A callback that returns the message template prefix.
|
|
429
|
-
* @throws {TypeError} If no log record was made inside the callback.
|
|
430
|
-
*/
|
|
431
|
-
info(callback: LogCallback): void;
|
|
432
|
-
/**
|
|
433
|
-
* Log a warning.
|
|
434
|
-
*
|
|
435
|
-
* This overload is a shorthand for logging an {@link Error} instance as a
|
|
436
|
-
* structured property.
|
|
437
|
-
*
|
|
438
|
-
* ```typescript
|
|
439
|
-
* logger.warn(new Error("Oops"));
|
|
440
|
-
* ```
|
|
441
|
-
*
|
|
442
|
-
* Note that this uses `{error.message}` as the default message template.
|
|
443
|
-
* If you want to include the stack trace in text output, include `{error}`
|
|
444
|
-
* in the message template instead.
|
|
445
|
-
*
|
|
446
|
-
* @param error The error to log.
|
|
447
|
-
* @since 2.0.0
|
|
448
|
-
*/
|
|
449
|
-
warn(error: Error): void;
|
|
450
|
-
/**
|
|
451
|
-
* Log a warning message with an {@link Error}.
|
|
452
|
-
*
|
|
453
|
-
* ```typescript
|
|
454
|
-
* logger.warn("Failed to do something", new Error("Oops"));
|
|
455
|
-
* ```
|
|
456
|
-
*
|
|
457
|
-
* @param message The message.
|
|
458
|
-
* @param error The error to log.
|
|
459
|
-
* @since 2.0.0
|
|
460
|
-
*/
|
|
461
|
-
warn(message: string, error: Error): void;
|
|
462
|
-
/**
|
|
463
|
-
* Log a warning message. Use this as a template string prefix.
|
|
464
|
-
*
|
|
465
|
-
* ```typescript
|
|
466
|
-
* logger.warn `A warning message with ${value}.`;
|
|
467
|
-
* ```
|
|
468
|
-
*
|
|
469
|
-
* @param message The message template strings array.
|
|
470
|
-
* @param values The message template values.
|
|
471
|
-
*/
|
|
472
|
-
warn(message: TemplateStringsArray, ...values: readonly unknown[]): void;
|
|
473
|
-
/**
|
|
474
|
-
* Log a warning message with properties.
|
|
475
|
-
*
|
|
476
|
-
* ```typescript
|
|
477
|
-
* logger.warn('A warning message with {value}.', { value });
|
|
478
|
-
* ```
|
|
479
|
-
*
|
|
480
|
-
* If the properties are expensive to compute, you can pass a callback that
|
|
481
|
-
* returns the properties:
|
|
482
|
-
*
|
|
483
|
-
* ```typescript
|
|
484
|
-
* logger.warn(
|
|
485
|
-
* 'A warning message with {value}.',
|
|
486
|
-
* () => ({ value: expensiveComputation() })
|
|
487
|
-
* );
|
|
488
|
-
* ```
|
|
489
|
-
*
|
|
490
|
-
* @param message The message template. Placeholders to be replaced with
|
|
491
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
492
|
-
* `{value}`).
|
|
493
|
-
* @param properties The values to replace placeholders with. For lazy
|
|
494
|
-
* evaluation, this can be a callback that returns the
|
|
495
|
-
* properties.
|
|
496
|
-
*/
|
|
497
|
-
warn(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
498
|
-
/**
|
|
499
|
-
* Log a warning message with properties computed asynchronously.
|
|
500
|
-
*
|
|
501
|
-
* Use this when the properties require async operations to compute:
|
|
502
|
-
*
|
|
503
|
-
* ```typescript
|
|
504
|
-
* await logger.warn(
|
|
505
|
-
* 'A warning message with {value}.',
|
|
506
|
-
* async () => ({ value: await fetchValue() })
|
|
507
|
-
* );
|
|
508
|
-
* ```
|
|
509
|
-
*
|
|
510
|
-
* @param message The message template. Placeholders to be replaced with
|
|
511
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
512
|
-
* `{value}`).
|
|
513
|
-
* @param properties An async callback that returns the properties.
|
|
514
|
-
* @returns A promise that resolves when the log is written.
|
|
515
|
-
* @since 2.0.0
|
|
516
|
-
*/
|
|
517
|
-
warn(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
|
|
518
|
-
/**
|
|
519
|
-
* Log a warning values with no message. This is useful when you
|
|
520
|
-
* want to log properties without a message, e.g., when you want to log
|
|
521
|
-
* the context of a request or an operation.
|
|
522
|
-
*
|
|
523
|
-
* ```typescript
|
|
524
|
-
* logger.warn({ method: 'GET', url: '/api/v1/resource' });
|
|
525
|
-
* ```
|
|
526
|
-
*
|
|
527
|
-
* Note that this is a shorthand for:
|
|
528
|
-
*
|
|
529
|
-
* ```typescript
|
|
530
|
-
* logger.warn('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
531
|
-
* ```
|
|
532
|
-
*
|
|
533
|
-
* If the properties are expensive to compute, you cannot use this shorthand
|
|
534
|
-
* and should use the following syntax instead:
|
|
535
|
-
*
|
|
536
|
-
* ```typescript
|
|
537
|
-
* logger.warn('{*}', () => ({
|
|
538
|
-
* method: expensiveMethod(),
|
|
539
|
-
* url: expensiveUrl(),
|
|
540
|
-
* }));
|
|
541
|
-
* ```
|
|
542
|
-
*
|
|
543
|
-
* @param properties The values to log. Note that this does not take
|
|
544
|
-
* a callback.
|
|
545
|
-
* @since 0.11.0
|
|
546
|
-
*/
|
|
547
|
-
warn(properties: Record<string, unknown>): void;
|
|
548
|
-
/**
|
|
549
|
-
* Lazily log a warning message. Use this when the message values are
|
|
550
|
-
* expensive to compute and should only be computed if the message is actually
|
|
551
|
-
* logged.
|
|
552
|
-
*
|
|
553
|
-
* ```typescript
|
|
554
|
-
* logger.warn(l => l`A warning message with ${expensiveValue()}.`);
|
|
555
|
-
* ```
|
|
556
|
-
*
|
|
557
|
-
* @param callback A callback that returns the message template prefix.
|
|
558
|
-
* @throws {TypeError} If no log record was made inside the callback.
|
|
559
|
-
*/
|
|
560
|
-
warn(callback: LogCallback): void;
|
|
561
|
-
/**
|
|
562
|
-
* Log a warning.
|
|
563
|
-
*
|
|
564
|
-
* This overload is a shorthand for logging an {@link Error} instance as a
|
|
565
|
-
* structured property.
|
|
566
|
-
*
|
|
567
|
-
* ```typescript
|
|
568
|
-
* logger.warning(new Error("Oops"));
|
|
569
|
-
* ```
|
|
570
|
-
*
|
|
571
|
-
* Note that this uses `{error.message}` as the default message template.
|
|
572
|
-
* If you want to include the stack trace in text output, include `{error}`
|
|
573
|
-
* in the message template instead.
|
|
574
|
-
*
|
|
575
|
-
* @param error The error to log.
|
|
576
|
-
* @since 2.0.0
|
|
577
|
-
*/
|
|
578
|
-
warning(error: Error): void;
|
|
579
|
-
/**
|
|
580
|
-
* Log a warning message with an {@link Error}.
|
|
581
|
-
*
|
|
582
|
-
* ```typescript
|
|
583
|
-
* logger.warning("Failed to do something", new Error("Oops"));
|
|
584
|
-
* ```
|
|
585
|
-
*
|
|
586
|
-
* @param message The message.
|
|
587
|
-
* @param error The error to log.
|
|
588
|
-
* @since 2.0.0
|
|
589
|
-
*/
|
|
590
|
-
warning(message: string, error: Error): void;
|
|
591
|
-
/**
|
|
592
|
-
* Log a warning message. Use this as a template string prefix.
|
|
593
|
-
*
|
|
594
|
-
* ```typescript
|
|
595
|
-
* logger.warning `A warning message with ${value}.`;
|
|
596
|
-
* ```
|
|
597
|
-
*
|
|
598
|
-
* @param message The message template strings array.
|
|
599
|
-
* @param values The message template values.
|
|
600
|
-
* @since 0.12.0
|
|
601
|
-
*/
|
|
602
|
-
warning(message: TemplateStringsArray, ...values: readonly unknown[]): void;
|
|
603
|
-
/**
|
|
604
|
-
* Log a warning message with properties.
|
|
605
|
-
*
|
|
606
|
-
* ```typescript
|
|
607
|
-
* logger.warning('A warning message with {value}.', { value });
|
|
608
|
-
* ```
|
|
609
|
-
*
|
|
610
|
-
* If the properties are expensive to compute, you can pass a callback that
|
|
611
|
-
* returns the properties:
|
|
612
|
-
*
|
|
613
|
-
* ```typescript
|
|
614
|
-
* logger.warning(
|
|
615
|
-
* 'A warning message with {value}.',
|
|
616
|
-
* () => ({ value: expensiveComputation() })
|
|
617
|
-
* );
|
|
618
|
-
* ```
|
|
619
|
-
*
|
|
620
|
-
* @param message The message template. Placeholders to be replaced with
|
|
621
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
622
|
-
* `{value}`).
|
|
623
|
-
* @param properties The values to replace placeholders with. For lazy
|
|
624
|
-
* evaluation, this can be a callback that returns the
|
|
625
|
-
* properties.
|
|
626
|
-
* @since 0.12.0
|
|
627
|
-
*/
|
|
628
|
-
warning(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
629
|
-
/**
|
|
630
|
-
* Log a warning message with properties computed asynchronously.
|
|
631
|
-
*
|
|
632
|
-
* Use this when the properties require async operations to compute:
|
|
633
|
-
*
|
|
634
|
-
* ```typescript
|
|
635
|
-
* await logger.warning(
|
|
636
|
-
* 'A warning message with {value}.',
|
|
637
|
-
* async () => ({ value: await fetchValue() })
|
|
638
|
-
* );
|
|
639
|
-
* ```
|
|
640
|
-
*
|
|
641
|
-
* @param message The message template. Placeholders to be replaced with
|
|
642
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
643
|
-
* `{value}`).
|
|
644
|
-
* @param properties An async callback that returns the properties.
|
|
645
|
-
* @returns A promise that resolves when the log is written.
|
|
646
|
-
* @since 2.0.0
|
|
647
|
-
*/
|
|
648
|
-
warning(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
|
|
649
|
-
/**
|
|
650
|
-
* Log a warning values with no message. This is useful when you
|
|
651
|
-
* want to log properties without a message, e.g., when you want to log
|
|
652
|
-
* the context of a request or an operation.
|
|
653
|
-
*
|
|
654
|
-
* ```typescript
|
|
655
|
-
* logger.warning({ method: 'GET', url: '/api/v1/resource' });
|
|
656
|
-
* ```
|
|
657
|
-
*
|
|
658
|
-
* Note that this is a shorthand for:
|
|
659
|
-
*
|
|
660
|
-
* ```typescript
|
|
661
|
-
* logger.warning('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
662
|
-
* ```
|
|
663
|
-
*
|
|
664
|
-
* If the properties are expensive to compute, you cannot use this shorthand
|
|
665
|
-
* and should use the following syntax instead:
|
|
666
|
-
*
|
|
667
|
-
* ```typescript
|
|
668
|
-
* logger.warning('{*}', () => ({
|
|
669
|
-
* method: expensiveMethod(),
|
|
670
|
-
* url: expensiveUrl(),
|
|
671
|
-
* }));
|
|
672
|
-
* ```
|
|
673
|
-
*
|
|
674
|
-
* @param properties The values to log. Note that this does not take
|
|
675
|
-
* a callback.
|
|
676
|
-
* @since 0.12.0
|
|
677
|
-
*/
|
|
678
|
-
warning(properties: Record<string, unknown>): void;
|
|
679
|
-
/**
|
|
680
|
-
* Lazily log a warning message. Use this when the message values are
|
|
681
|
-
* expensive to compute and should only be computed if the message is actually
|
|
682
|
-
* logged.
|
|
683
|
-
*
|
|
684
|
-
* ```typescript
|
|
685
|
-
* logger.warning(l => l`A warning message with ${expensiveValue()}.`);
|
|
686
|
-
* ```
|
|
687
|
-
*
|
|
688
|
-
* @param callback A callback that returns the message template prefix.
|
|
689
|
-
* @throws {TypeError} If no log record was made inside the callback.
|
|
690
|
-
* @since 0.12.0
|
|
691
|
-
*/
|
|
692
|
-
warning(callback: LogCallback): void;
|
|
693
|
-
/**
|
|
694
|
-
* Log an error.
|
|
695
|
-
*
|
|
696
|
-
* This overload is a shorthand for logging an {@link Error} instance as a
|
|
697
|
-
* structured property.
|
|
698
|
-
*
|
|
699
|
-
* ```typescript
|
|
700
|
-
* logger.error(new Error("Oops"));
|
|
701
|
-
* ```
|
|
702
|
-
*
|
|
703
|
-
* Note that this uses `{error.message}` as the default message template.
|
|
704
|
-
* If you want to include the stack trace in text output, include `{error}`
|
|
705
|
-
* in the message template instead.
|
|
706
|
-
*
|
|
707
|
-
* @param error The error to log.
|
|
708
|
-
* @since 2.0.0
|
|
709
|
-
*/
|
|
710
|
-
error(error: Error): void;
|
|
711
|
-
/**
|
|
712
|
-
* Log an error message with an {@link Error}.
|
|
713
|
-
*
|
|
714
|
-
* ```typescript
|
|
715
|
-
* logger.error("Failed to do something", new Error("Oops"));
|
|
716
|
-
* ```
|
|
717
|
-
*
|
|
718
|
-
* @param message The message.
|
|
719
|
-
* @param error The error to log.
|
|
720
|
-
* @since 2.0.0
|
|
721
|
-
*/
|
|
722
|
-
error(message: string, error: Error): void;
|
|
723
|
-
/**
|
|
724
|
-
* Log an error message. Use this as a template string prefix.
|
|
725
|
-
*
|
|
726
|
-
* ```typescript
|
|
727
|
-
* logger.error `An error message with ${value}.`;
|
|
728
|
-
* ```
|
|
729
|
-
*
|
|
730
|
-
* @param message The message template strings array.
|
|
731
|
-
* @param values The message template values.
|
|
732
|
-
*/
|
|
733
|
-
error(message: TemplateStringsArray, ...values: readonly unknown[]): void;
|
|
734
|
-
/**
|
|
735
|
-
* Log an error message with properties.
|
|
736
|
-
*
|
|
737
|
-
* ```typescript
|
|
738
|
-
* logger.warn('An error message with {value}.', { value });
|
|
739
|
-
* ```
|
|
740
|
-
*
|
|
741
|
-
* If the properties are expensive to compute, you can pass a callback that
|
|
742
|
-
* returns the properties:
|
|
743
|
-
*
|
|
744
|
-
* ```typescript
|
|
745
|
-
* logger.error(
|
|
746
|
-
* 'An error message with {value}.',
|
|
747
|
-
* () => ({ value: expensiveComputation() })
|
|
748
|
-
* );
|
|
749
|
-
* ```
|
|
750
|
-
*
|
|
751
|
-
* @param message The message template. Placeholders to be replaced with
|
|
752
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
753
|
-
* `{value}`).
|
|
754
|
-
* @param properties The values to replace placeholders with. For lazy
|
|
755
|
-
* evaluation, this can be a callback that returns the
|
|
756
|
-
* properties.
|
|
757
|
-
*/
|
|
758
|
-
error(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
759
|
-
/**
|
|
760
|
-
* Log an error message with properties computed asynchronously.
|
|
761
|
-
*
|
|
762
|
-
* Use this when the properties require async operations to compute:
|
|
763
|
-
*
|
|
764
|
-
* ```typescript
|
|
765
|
-
* await logger.error(
|
|
766
|
-
* 'An error message with {value}.',
|
|
767
|
-
* async () => ({ value: await fetchValue() })
|
|
768
|
-
* );
|
|
769
|
-
* ```
|
|
770
|
-
*
|
|
771
|
-
* @param message The message template. Placeholders to be replaced with
|
|
772
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
773
|
-
* `{value}`).
|
|
774
|
-
* @param properties An async callback that returns the properties.
|
|
775
|
-
* @returns A promise that resolves when the log is written.
|
|
776
|
-
* @since 2.0.0
|
|
777
|
-
*/
|
|
778
|
-
error(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
|
|
779
|
-
/**
|
|
780
|
-
* Log an error values with no message. This is useful when you
|
|
781
|
-
* want to log properties without a message, e.g., when you want to log
|
|
782
|
-
* the context of a request or an operation.
|
|
783
|
-
*
|
|
784
|
-
* ```typescript
|
|
785
|
-
* logger.error({ method: 'GET', url: '/api/v1/resource' });
|
|
786
|
-
* ```
|
|
787
|
-
*
|
|
788
|
-
* Note that this is a shorthand for:
|
|
789
|
-
*
|
|
790
|
-
* ```typescript
|
|
791
|
-
* logger.error('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
792
|
-
* ```
|
|
793
|
-
*
|
|
794
|
-
* If the properties are expensive to compute, you cannot use this shorthand
|
|
795
|
-
* and should use the following syntax instead:
|
|
796
|
-
*
|
|
797
|
-
* ```typescript
|
|
798
|
-
* logger.error('{*}', () => ({
|
|
799
|
-
* method: expensiveMethod(),
|
|
800
|
-
* url: expensiveUrl(),
|
|
801
|
-
* }));
|
|
802
|
-
* ```
|
|
803
|
-
*
|
|
804
|
-
* @param properties The values to log. Note that this does not take
|
|
805
|
-
* a callback.
|
|
806
|
-
* @since 0.11.0
|
|
807
|
-
*/
|
|
808
|
-
error(properties: Record<string, unknown>): void;
|
|
809
|
-
/**
|
|
810
|
-
* Lazily log an error message. Use this when the message values are
|
|
811
|
-
* expensive to compute and should only be computed if the message is actually
|
|
812
|
-
* logged.
|
|
813
|
-
*
|
|
814
|
-
* ```typescript
|
|
815
|
-
* logger.error(l => l`An error message with ${expensiveValue()}.`);
|
|
816
|
-
* ```
|
|
817
|
-
*
|
|
818
|
-
* @param callback A callback that returns the message template prefix.
|
|
819
|
-
* @throws {TypeError} If no log record was made inside the callback.
|
|
820
|
-
*/
|
|
821
|
-
error(callback: LogCallback): void;
|
|
822
|
-
/**
|
|
823
|
-
* Log a fatal error.
|
|
824
|
-
*
|
|
825
|
-
* This overload is a shorthand for logging an {@link Error} instance as a
|
|
826
|
-
* structured property.
|
|
827
|
-
*
|
|
828
|
-
* ```typescript
|
|
829
|
-
* logger.fatal(new Error("Oops"));
|
|
830
|
-
* ```
|
|
831
|
-
*
|
|
832
|
-
* Note that this uses `{error.message}` as the default message template.
|
|
833
|
-
* If you want to include the stack trace in text output, include `{error}`
|
|
834
|
-
* in the message template instead.
|
|
835
|
-
*
|
|
836
|
-
* @param error The error to log.
|
|
837
|
-
* @since 2.0.0
|
|
838
|
-
*/
|
|
839
|
-
fatal(error: Error): void;
|
|
840
|
-
/**
|
|
841
|
-
* Log a fatal error message with an {@link Error}.
|
|
842
|
-
*
|
|
843
|
-
* ```typescript
|
|
844
|
-
* logger.fatal("Failed to do something", new Error("Oops"));
|
|
845
|
-
* ```
|
|
846
|
-
*
|
|
847
|
-
* @param message The message.
|
|
848
|
-
* @param error The error to log.
|
|
849
|
-
* @since 2.0.0
|
|
850
|
-
*/
|
|
851
|
-
fatal(message: string, error: Error): void;
|
|
852
|
-
/**
|
|
853
|
-
* Log a fatal error message. Use this as a template string prefix.
|
|
854
|
-
*
|
|
855
|
-
* ```typescript
|
|
856
|
-
* logger.fatal `A fatal error message with ${value}.`;
|
|
857
|
-
* ```
|
|
858
|
-
*
|
|
859
|
-
* @param message The message template strings array.
|
|
860
|
-
* @param values The message template values.
|
|
861
|
-
*/
|
|
862
|
-
fatal(message: TemplateStringsArray, ...values: readonly unknown[]): void;
|
|
863
|
-
/**
|
|
864
|
-
* Log a fatal error message with properties.
|
|
865
|
-
*
|
|
866
|
-
* ```typescript
|
|
867
|
-
* logger.warn('A fatal error message with {value}.', { value });
|
|
868
|
-
* ```
|
|
869
|
-
*
|
|
870
|
-
* If the properties are expensive to compute, you can pass a callback that
|
|
871
|
-
* returns the properties:
|
|
872
|
-
*
|
|
873
|
-
* ```typescript
|
|
874
|
-
* logger.fatal(
|
|
875
|
-
* 'A fatal error message with {value}.',
|
|
876
|
-
* () => ({ value: expensiveComputation() })
|
|
877
|
-
* );
|
|
878
|
-
* ```
|
|
879
|
-
*
|
|
880
|
-
* @param message The message template. Placeholders to be replaced with
|
|
881
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
882
|
-
* `{value}`).
|
|
883
|
-
* @param properties The values to replace placeholders with. For lazy
|
|
884
|
-
* evaluation, this can be a callback that returns the
|
|
885
|
-
* properties.
|
|
886
|
-
*/
|
|
887
|
-
fatal(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
|
|
888
|
-
/**
|
|
889
|
-
* Log a fatal error message with properties computed asynchronously.
|
|
890
|
-
*
|
|
891
|
-
* Use this when the properties require async operations to compute:
|
|
892
|
-
*
|
|
893
|
-
* ```typescript
|
|
894
|
-
* await logger.fatal(
|
|
895
|
-
* 'A fatal error message with {value}.',
|
|
896
|
-
* async () => ({ value: await fetchValue() })
|
|
897
|
-
* );
|
|
898
|
-
* ```
|
|
899
|
-
*
|
|
900
|
-
* @param message The message template. Placeholders to be replaced with
|
|
901
|
-
* `values` are indicated by keys in curly braces (e.g.,
|
|
902
|
-
* `{value}`).
|
|
903
|
-
* @param properties An async callback that returns the properties.
|
|
904
|
-
* @returns A promise that resolves when the log is written.
|
|
905
|
-
* @since 2.0.0
|
|
906
|
-
*/
|
|
907
|
-
fatal(message: string, properties: () => Promise<Record<string, unknown>>): Promise<void>;
|
|
908
|
-
/**
|
|
909
|
-
* Log a fatal error values with no message. This is useful when you
|
|
910
|
-
* want to log properties without a message, e.g., when you want to log
|
|
911
|
-
* the context of a request or an operation.
|
|
912
|
-
*
|
|
913
|
-
* ```typescript
|
|
914
|
-
* logger.fatal({ method: 'GET', url: '/api/v1/resource' });
|
|
915
|
-
* ```
|
|
916
|
-
*
|
|
917
|
-
* Note that this is a shorthand for:
|
|
918
|
-
*
|
|
919
|
-
* ```typescript
|
|
920
|
-
* logger.fatal('{*}', { method: 'GET', url: '/api/v1/resource' });
|
|
921
|
-
* ```
|
|
922
|
-
*
|
|
923
|
-
* If the properties are expensive to compute, you cannot use this shorthand
|
|
924
|
-
* and should use the following syntax instead:
|
|
925
|
-
*
|
|
926
|
-
* ```typescript
|
|
927
|
-
* logger.fatal('{*}', () => ({
|
|
928
|
-
* method: expensiveMethod(),
|
|
929
|
-
* url: expensiveUrl(),
|
|
930
|
-
* }));
|
|
931
|
-
* ```
|
|
932
|
-
*
|
|
933
|
-
* @param properties The values to log. Note that this does not take
|
|
934
|
-
* a callback.
|
|
935
|
-
* @since 0.11.0
|
|
936
|
-
*/
|
|
937
|
-
fatal(properties: Record<string, unknown>): void;
|
|
938
|
-
/**
|
|
939
|
-
* Lazily log a fatal error message. Use this when the message values are
|
|
940
|
-
* expensive to compute and should only be computed if the message is actually
|
|
941
|
-
* logged.
|
|
942
|
-
*
|
|
943
|
-
* ```typescript
|
|
944
|
-
* logger.fatal(l => l`A fatal error message with ${expensiveValue()}.`);
|
|
945
|
-
* ```
|
|
946
|
-
*
|
|
947
|
-
* @param callback A callback that returns the message template prefix.
|
|
948
|
-
* @throws {TypeError} If no log record was made inside the callback.
|
|
949
|
-
*/
|
|
950
|
-
fatal(callback: LogCallback): void;
|
|
951
|
-
/**
|
|
952
|
-
* Emits a log record with custom fields while using this logger's
|
|
953
|
-
* category.
|
|
954
|
-
*
|
|
955
|
-
* This is a low-level API for integration scenarios where you need full
|
|
956
|
-
* control over the log record, particularly for preserving timestamps
|
|
957
|
-
* from external systems.
|
|
958
|
-
*
|
|
959
|
-
* ```typescript
|
|
960
|
-
* const logger = getLogger(["my-app", "integration"]);
|
|
961
|
-
*
|
|
962
|
-
* // Emit a log with a custom timestamp
|
|
963
|
-
* logger.emit({
|
|
964
|
-
* timestamp: kafkaLog.originalTimestamp,
|
|
965
|
-
* level: "info",
|
|
966
|
-
* message: [kafkaLog.message],
|
|
967
|
-
* rawMessage: kafkaLog.message,
|
|
968
|
-
* properties: {
|
|
969
|
-
* source: "kafka",
|
|
970
|
-
* partition: kafkaLog.partition,
|
|
971
|
-
* offset: kafkaLog.offset,
|
|
972
|
-
* },
|
|
973
|
-
* });
|
|
974
|
-
* ```
|
|
975
|
-
*
|
|
976
|
-
* @param record Log record without category field (category comes from
|
|
977
|
-
* the logger instance)
|
|
978
|
-
* @since 1.1.0
|
|
979
|
-
*/
|
|
980
|
-
emit(record: Omit<LogRecord, "category">): void;
|
|
981
|
-
/**
|
|
982
|
-
* Check if a message of the given severity level would be processed by
|
|
983
|
-
* this logger.
|
|
984
|
-
*
|
|
985
|
-
* This is useful for conditionally executing expensive computations
|
|
986
|
-
* before logging, particularly for async operations where lazy
|
|
987
|
-
* evaluation callbacks cannot be used:
|
|
988
|
-
*
|
|
989
|
-
* ```typescript
|
|
990
|
-
* if (logger.isEnabledFor("debug")) {
|
|
991
|
-
* const result = await expensiveAsync();
|
|
992
|
-
* logger.debug("Result: {result}", { result });
|
|
993
|
-
* }
|
|
994
|
-
* ```
|
|
995
|
-
*
|
|
996
|
-
* @param level The log level to check.
|
|
997
|
-
* @returns `true` if a message of the given level would be logged,
|
|
998
|
-
* `false` otherwise.
|
|
999
|
-
* @since 2.0.0
|
|
1000
|
-
*/
|
|
1001
|
-
isEnabledFor(level: LogLevel): boolean;
|
|
1002
|
-
}
|
|
1003
|
-
/**
|
|
1004
|
-
* A logging callback function. It is used to defer the computation of a
|
|
1005
|
-
* message template until it is actually logged.
|
|
1006
|
-
* @param prefix The message template prefix.
|
|
1007
|
-
* @returns The rendered message array.
|
|
1008
|
-
*/
|
|
1009
|
-
type LogCallback = (prefix: LogTemplatePrefix) => unknown[];
|
|
1010
|
-
/**
|
|
1011
|
-
* A logging template prefix function. It is used to log a message in
|
|
1012
|
-
* a {@link LogCallback} function.
|
|
1013
|
-
* @param message The message template strings array.
|
|
1014
|
-
* @param values The message template values.
|
|
1015
|
-
* @returns The rendered message array.
|
|
1016
|
-
*/
|
|
1017
|
-
type LogTemplatePrefix = (message: TemplateStringsArray, ...values: unknown[]) => unknown[];
|
|
1018
|
-
/**
|
|
1019
|
-
* A function type for logging methods in the {@link Logger} interface.
|
|
1020
|
-
* @since 1.0.0
|
|
1021
|
-
*/
|
|
1022
|
-
//#endregion
|
|
1023
|
-
export { Logger as t };
|