@logtape/file 0.9.0-dev.134 → 0.9.1-dev.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/file/filesink.base.js +1 -1
- package/package.json +4 -1
- package/script/file/filesink.base.js +3 -3
- package/types/file/filesink.base.d.ts +1 -1
- package/types/file/filesink.base.d.ts.map +1 -1
- package/types/file/filesink.node.d.ts +1 -1
- package/types/file/filesink.node.d.ts.map +1 -1
- package/esm/_dnt.shims.js +0 -57
- package/esm/logtape/config.js +0 -287
- package/esm/logtape/context.js +0 -23
- package/esm/logtape/filter.js +0 -42
- package/esm/logtape/formatter.js +0 -261
- package/esm/logtape/level.js +0 -59
- package/esm/logtape/logger.js +0 -480
- package/esm/logtape/mod.js +0 -8
- package/esm/logtape/nodeUtil.js +0 -2
- package/esm/logtape/record.js +0 -1
- package/esm/logtape/sink.js +0 -96
- package/script/_dnt.shims.js +0 -60
- package/script/logtape/config.js +0 -321
- package/script/logtape/context.js +0 -26
- package/script/logtape/filter.js +0 -46
- package/script/logtape/formatter.js +0 -270
- package/script/logtape/level.js +0 -64
- package/script/logtape/logger.js +0 -511
- package/script/logtape/mod.js +0 -34
- package/script/logtape/nodeUtil.js +0 -7
- package/script/logtape/record.js +0 -2
- package/script/logtape/sink.js +0 -101
- package/types/_dnt.shims.d.ts +0 -2
- package/types/_dnt.shims.d.ts.map +0 -1
- package/types/logtape/config.d.ts +0 -183
- package/types/logtape/config.d.ts.map +0 -1
- package/types/logtape/context.d.ts +0 -35
- package/types/logtape/context.d.ts.map +0 -1
- package/types/logtape/filter.d.ts +0 -31
- package/types/logtape/filter.d.ts.map +0 -1
- package/types/logtape/formatter.d.ts +0 -260
- package/types/logtape/formatter.d.ts.map +0 -1
- package/types/logtape/level.d.ts +0 -32
- package/types/logtape/logger.d.ts +0 -423
- package/types/logtape/logger.d.ts.map +0 -1
- package/types/logtape/mod.d.ts +0 -9
- package/types/logtape/mod.d.ts.map +0 -1
- package/types/logtape/nodeUtil.d.ts +0 -3
- package/types/logtape/nodeUtil.d.ts.map +0 -1
- package/types/logtape/record.d.ts +0 -44
- package/types/logtape/sink.d.ts +0 -108
- package/types/logtape/sink.d.ts.map +0 -1
package/script/logtape/sink.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withFilter = withFilter;
|
|
4
|
-
exports.getStreamSink = getStreamSink;
|
|
5
|
-
exports.getConsoleSink = getConsoleSink;
|
|
6
|
-
const filter_js_1 = require("./filter.js");
|
|
7
|
-
const formatter_js_1 = require("./formatter.js");
|
|
8
|
-
/**
|
|
9
|
-
* Turns a sink into a filtered sink. The returned sink only logs records that
|
|
10
|
-
* pass the filter.
|
|
11
|
-
*
|
|
12
|
-
* @example Filter a console sink to only log records with the info level
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const sink = withFilter(getConsoleSink(), "info");
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* @param sink A sink to be filtered.
|
|
18
|
-
* @param filter A filter to apply to the sink. It can be either a filter
|
|
19
|
-
* function or a {@link LogLevel} string.
|
|
20
|
-
* @returns A sink that only logs records that pass the filter.
|
|
21
|
-
*/
|
|
22
|
-
function withFilter(sink, filter) {
|
|
23
|
-
const filterFunc = (0, filter_js_1.toFilter)(filter);
|
|
24
|
-
return (record) => {
|
|
25
|
-
if (filterFunc(record))
|
|
26
|
-
sink(record);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* A factory that returns a sink that writes to a {@link WritableStream}.
|
|
31
|
-
*
|
|
32
|
-
* Note that the `stream` is of Web Streams API, which is different from
|
|
33
|
-
* Node.js streams. You can convert a Node.js stream to a Web Streams API
|
|
34
|
-
* stream using [`stream.Writable.toWeb()`] method.
|
|
35
|
-
*
|
|
36
|
-
* [`stream.Writable.toWeb()`]: https://nodejs.org/api/stream.html#streamwritabletowebstreamwritable
|
|
37
|
-
*
|
|
38
|
-
* @example Sink to the standard error in Deno
|
|
39
|
-
* ```typescript
|
|
40
|
-
* const stderrSink = getStreamSink(Deno.stderr.writable);
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @example Sink to the standard error in Node.js
|
|
44
|
-
* ```typescript
|
|
45
|
-
* import stream from "node:stream";
|
|
46
|
-
* const stderrSink = getStreamSink(stream.Writable.toWeb(process.stderr));
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* @param stream The stream to write to.
|
|
50
|
-
* @param options The options for the sink.
|
|
51
|
-
* @returns A sink that writes to the stream.
|
|
52
|
-
*/
|
|
53
|
-
function getStreamSink(stream, options = {}) {
|
|
54
|
-
const formatter = options.formatter ?? formatter_js_1.defaultTextFormatter;
|
|
55
|
-
const encoder = options.encoder ?? new TextEncoder();
|
|
56
|
-
const writer = stream.getWriter();
|
|
57
|
-
let lastPromise = Promise.resolve();
|
|
58
|
-
const sink = (record) => {
|
|
59
|
-
const bytes = encoder.encode(formatter(record));
|
|
60
|
-
lastPromise = lastPromise
|
|
61
|
-
.then(() => writer.ready)
|
|
62
|
-
.then(() => writer.write(bytes));
|
|
63
|
-
};
|
|
64
|
-
sink[Symbol.asyncDispose] = async () => {
|
|
65
|
-
await lastPromise;
|
|
66
|
-
await writer.close();
|
|
67
|
-
};
|
|
68
|
-
return sink;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* A console sink factory that returns a sink that logs to the console.
|
|
72
|
-
*
|
|
73
|
-
* @param options The options for the sink.
|
|
74
|
-
* @returns A sink that logs to the console.
|
|
75
|
-
*/
|
|
76
|
-
function getConsoleSink(options = {}) {
|
|
77
|
-
const formatter = options.formatter ?? formatter_js_1.defaultConsoleFormatter;
|
|
78
|
-
const levelMap = {
|
|
79
|
-
debug: "debug",
|
|
80
|
-
info: "info",
|
|
81
|
-
warning: "warn",
|
|
82
|
-
error: "error",
|
|
83
|
-
fatal: "error",
|
|
84
|
-
...(options.levelMap ?? {}),
|
|
85
|
-
};
|
|
86
|
-
const console = options.console ?? globalThis.console;
|
|
87
|
-
return (record) => {
|
|
88
|
-
const args = formatter(record);
|
|
89
|
-
const method = levelMap[record.level];
|
|
90
|
-
if (method === undefined) {
|
|
91
|
-
throw new TypeError(`Invalid log level: ${record.level}.`);
|
|
92
|
-
}
|
|
93
|
-
if (typeof args === "string") {
|
|
94
|
-
const msg = args.replace(/\r?\n$/, "");
|
|
95
|
-
console[method](msg);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
console[method](...args);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
}
|
package/types/_dnt.shims.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import type { ContextLocalStorage } from "./context.js";
|
|
2
|
-
import { type FilterLike } from "./filter.js";
|
|
3
|
-
import type { LogLevel } from "./level.js";
|
|
4
|
-
import { type Sink } from "./sink.js";
|
|
5
|
-
/**
|
|
6
|
-
* A configuration for the loggers.
|
|
7
|
-
*/
|
|
8
|
-
export interface Config<TSinkId extends string, TFilterId extends string> {
|
|
9
|
-
/**
|
|
10
|
-
* The sinks to use. The keys are the sink identifiers, and the values are
|
|
11
|
-
* {@link Sink}s.
|
|
12
|
-
*/
|
|
13
|
-
sinks: Record<TSinkId, Sink>;
|
|
14
|
-
/**
|
|
15
|
-
* The filters to use. The keys are the filter identifiers, and the values
|
|
16
|
-
* are either {@link Filter}s or {@link LogLevel}s.
|
|
17
|
-
*/
|
|
18
|
-
filters?: Record<TFilterId, FilterLike>;
|
|
19
|
-
/**
|
|
20
|
-
* The loggers to configure.
|
|
21
|
-
*/
|
|
22
|
-
loggers: LoggerConfig<TSinkId, TFilterId>[];
|
|
23
|
-
/**
|
|
24
|
-
* The context-local storage to use for implicit contexts.
|
|
25
|
-
* @since 0.7.0
|
|
26
|
-
*/
|
|
27
|
-
contextLocalStorage?: ContextLocalStorage<Record<string, unknown>>;
|
|
28
|
-
/**
|
|
29
|
-
* Whether to reset the configuration before applying this one.
|
|
30
|
-
*/
|
|
31
|
-
reset?: boolean;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* A logger configuration.
|
|
35
|
-
*/
|
|
36
|
-
export interface LoggerConfig<TSinkId extends string, TFilterId extends string> {
|
|
37
|
-
/**
|
|
38
|
-
* The category of the logger. If a string, it is equivalent to an array
|
|
39
|
-
* with one element.
|
|
40
|
-
*/
|
|
41
|
-
category: string | string[];
|
|
42
|
-
/**
|
|
43
|
-
* The sink identifiers to use.
|
|
44
|
-
*/
|
|
45
|
-
sinks?: TSinkId[];
|
|
46
|
-
/**
|
|
47
|
-
* Whether to inherit the parent's sinks. If `inherit`, the parent's sinks
|
|
48
|
-
* are used along with the specified sinks. If `override`, the parent's
|
|
49
|
-
* sinks are not used, and only the specified sinks are used.
|
|
50
|
-
*
|
|
51
|
-
* The default is `inherit`.
|
|
52
|
-
* @default `"inherit"
|
|
53
|
-
* @since 0.6.0
|
|
54
|
-
*/
|
|
55
|
-
parentSinks?: "inherit" | "override";
|
|
56
|
-
/**
|
|
57
|
-
* The filter identifiers to use.
|
|
58
|
-
*/
|
|
59
|
-
filters?: TFilterId[];
|
|
60
|
-
/**
|
|
61
|
-
* The log level to filter by. If `null`, the logger will reject all
|
|
62
|
-
* records.
|
|
63
|
-
* @deprecated Use `filters` instead for backward compatibility, or use
|
|
64
|
-
* `lowestLevel` for less-misleading behavior.
|
|
65
|
-
*/
|
|
66
|
-
level?: LogLevel | null;
|
|
67
|
-
/**
|
|
68
|
-
* The lowest log level to accept. If `null`, the logger will reject all
|
|
69
|
-
* records.
|
|
70
|
-
* @since 0.8.0
|
|
71
|
-
*/
|
|
72
|
-
lowestLevel?: LogLevel | null;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Configure the loggers with the specified configuration.
|
|
76
|
-
*
|
|
77
|
-
* Note that if the given sinks or filters are disposable, they will be
|
|
78
|
-
* disposed when the configuration is reset, or when the process exits.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* await configure({
|
|
83
|
-
* sinks: {
|
|
84
|
-
* console: getConsoleSink(),
|
|
85
|
-
* },
|
|
86
|
-
* filters: {
|
|
87
|
-
* slow: (log) =>
|
|
88
|
-
* "duration" in log.properties &&
|
|
89
|
-
* log.properties.duration as number > 1000,
|
|
90
|
-
* },
|
|
91
|
-
* loggers: [
|
|
92
|
-
* {
|
|
93
|
-
* category: "my-app",
|
|
94
|
-
* sinks: ["console"],
|
|
95
|
-
* level: "info",
|
|
96
|
-
* },
|
|
97
|
-
* {
|
|
98
|
-
* category: ["my-app", "sql"],
|
|
99
|
-
* filters: ["slow"],
|
|
100
|
-
* level: "debug",
|
|
101
|
-
* },
|
|
102
|
-
* {
|
|
103
|
-
* category: "logtape",
|
|
104
|
-
* sinks: ["console"],
|
|
105
|
-
* level: "error",
|
|
106
|
-
* },
|
|
107
|
-
* ],
|
|
108
|
-
* });
|
|
109
|
-
* ```
|
|
110
|
-
*
|
|
111
|
-
* @param config The configuration.
|
|
112
|
-
*/
|
|
113
|
-
export declare function configure<TSinkId extends string, TFilterId extends string>(config: Config<TSinkId, TFilterId>): Promise<void>;
|
|
114
|
-
/**
|
|
115
|
-
* Configure sync loggers with the specified configuration.
|
|
116
|
-
*
|
|
117
|
-
* Note that if the given sinks or filters are disposable, they will be
|
|
118
|
-
* disposed when the configuration is reset, or when the process exits.
|
|
119
|
-
*
|
|
120
|
-
* Also note that passing async sinks or filters will throw. If
|
|
121
|
-
* necessary use {@link resetSync} or {@link disposeSync}.
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* ```typescript
|
|
125
|
-
* configureSync({
|
|
126
|
-
* sinks: {
|
|
127
|
-
* console: getConsoleSink(),
|
|
128
|
-
* },
|
|
129
|
-
* loggers: [
|
|
130
|
-
* {
|
|
131
|
-
* category: "my-app",
|
|
132
|
-
* sinks: ["console"],
|
|
133
|
-
* level: "info",
|
|
134
|
-
* },
|
|
135
|
-
* {
|
|
136
|
-
* category: "logtape",
|
|
137
|
-
* sinks: ["console"],
|
|
138
|
-
* level: "error",
|
|
139
|
-
* },
|
|
140
|
-
* ],
|
|
141
|
-
* });
|
|
142
|
-
* ```
|
|
143
|
-
*
|
|
144
|
-
* @param config The configuration.
|
|
145
|
-
* @since 0.9.0
|
|
146
|
-
*/
|
|
147
|
-
export declare function configureSync<TSinkId extends string, TFilterId extends string>(config: Config<TSinkId, TFilterId>): void;
|
|
148
|
-
/**
|
|
149
|
-
* Get the current configuration, if any. Otherwise, `null`.
|
|
150
|
-
* @returns The current configuration, if any. Otherwise, `null`.
|
|
151
|
-
*/
|
|
152
|
-
export declare function getConfig(): Config<string, string> | null;
|
|
153
|
-
/**
|
|
154
|
-
* Reset the configuration. Mostly for testing purposes.
|
|
155
|
-
*/
|
|
156
|
-
export declare function reset(): Promise<void>;
|
|
157
|
-
/**
|
|
158
|
-
* Reset the configuration. Mostly for testing purposes. Will not clear async
|
|
159
|
-
* sinks, only use with sync sinks. Use {@link reset} if you have async sinks.
|
|
160
|
-
* @since 0.9.0
|
|
161
|
-
*/
|
|
162
|
-
export declare function resetSync(): void;
|
|
163
|
-
/**
|
|
164
|
-
* Dispose of the disposables.
|
|
165
|
-
*/
|
|
166
|
-
export declare function dispose(): Promise<void>;
|
|
167
|
-
/**
|
|
168
|
-
* Dispose of the sync disposables. Async disposables will be untouched,
|
|
169
|
-
* use {@link dispose} if you have async sinks.
|
|
170
|
-
* @since 0.9.0
|
|
171
|
-
*/
|
|
172
|
-
export declare function disposeSync(): void;
|
|
173
|
-
/**
|
|
174
|
-
* A configuration error.
|
|
175
|
-
*/
|
|
176
|
-
export declare class ConfigError extends Error {
|
|
177
|
-
/**
|
|
178
|
-
* Constructs a new configuration error.
|
|
179
|
-
* @param message The error message.
|
|
180
|
-
*/
|
|
181
|
-
constructor(message: string);
|
|
182
|
-
}
|
|
183
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/logtape/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,KAAK,UAAU,EAAY,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,OAAO,SAAS,MAAM,EAAE,SAAS,SAAS,MAAM;IACtE;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAExC;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;IAE5C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEnE;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY,CAC3B,OAAO,SAAS,MAAM,EACtB,SAAS,SAAS,MAAM;IAExB;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE5B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAElB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAErC;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IAEtB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAExB;;;;OAIG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC/B;AAqCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAsB,SAAS,CAC7B,OAAO,SAAS,MAAM,EACtB,SAAS,SAAS,MAAM,EACxB,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAanD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,aAAa,CAAC,OAAO,SAAS,MAAM,EAAE,SAAS,SAAS,MAAM,EAC5E,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,GACjC,IAAI,CAmBN;AAuGD;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAEzD;AAED;;GAEG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAG3C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAGhC;AAUD;;GAEG;AACH,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ7C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC;;;OAGG;gBACS,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A generic interface for a context-local storage. It resembles
|
|
3
|
-
* the {@link AsyncLocalStorage} API from Node.js.
|
|
4
|
-
* @typeParam T The type of the context-local store.
|
|
5
|
-
* @since 0.7.0
|
|
6
|
-
*/
|
|
7
|
-
export interface ContextLocalStorage<T> {
|
|
8
|
-
/**
|
|
9
|
-
* Runs a callback with the given store as the context-local store.
|
|
10
|
-
* @param store The store to use as the context-local store.
|
|
11
|
-
* @param callback The callback to run.
|
|
12
|
-
* @returns The return value of the callback.
|
|
13
|
-
*/
|
|
14
|
-
run<R>(store: T, callback: () => R): R;
|
|
15
|
-
/**
|
|
16
|
-
* Returns the current context-local store.
|
|
17
|
-
* @returns The current context-local store, or `undefined` if there is no
|
|
18
|
-
* store.
|
|
19
|
-
*/
|
|
20
|
-
getStore(): T | undefined;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Runs a callback with the given implicit context. Every single log record
|
|
24
|
-
* in the callback will have the given context.
|
|
25
|
-
*
|
|
26
|
-
* If no `contextLocalStorage` is configured, this function does nothing and
|
|
27
|
-
* just returns the return value of the callback. It also logs a warning to
|
|
28
|
-
* the `["logtape", "meta"]` logger in this case.
|
|
29
|
-
* @param context The context to inject.
|
|
30
|
-
* @param callback The callback to run.
|
|
31
|
-
* @returns The return value of the callback.
|
|
32
|
-
* @since 0.7.0
|
|
33
|
-
*/
|
|
34
|
-
export declare function withContext<T>(context: Record<string, unknown>, callback: () => T): T;
|
|
35
|
-
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/logtape/context.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAEvC;;;;OAIG;IACH,QAAQ,IAAI,CAAC,GAAG,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,EAAE,MAAM,CAAC,GAChB,CAAC,CAcH"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { LogLevel } from "./level.js";
|
|
2
|
-
import type { LogRecord } from "./record.js";
|
|
3
|
-
/**
|
|
4
|
-
* A filter is a function that accepts a log record and returns `true` if the
|
|
5
|
-
* record should be passed to the sink.
|
|
6
|
-
*
|
|
7
|
-
* @param record The log record to filter.
|
|
8
|
-
* @returns `true` if the record should be passed to the sink.
|
|
9
|
-
*/
|
|
10
|
-
export type Filter = (record: LogRecord) => boolean;
|
|
11
|
-
/**
|
|
12
|
-
* A filter-like value is either a {@link Filter} or a {@link LogLevel}.
|
|
13
|
-
* `null` is also allowed to represent a filter that rejects all records.
|
|
14
|
-
*/
|
|
15
|
-
export type FilterLike = Filter | LogLevel | null;
|
|
16
|
-
/**
|
|
17
|
-
* Converts a {@link FilterLike} value to an actual {@link Filter}.
|
|
18
|
-
*
|
|
19
|
-
* @param filter The filter-like value to convert.
|
|
20
|
-
* @returns The actual filter.
|
|
21
|
-
*/
|
|
22
|
-
export declare function toFilter(filter: FilterLike): Filter;
|
|
23
|
-
/**
|
|
24
|
-
* Returns a filter that accepts log records with the specified level.
|
|
25
|
-
*
|
|
26
|
-
* @param level The level to filter by. If `null`, the filter will reject all
|
|
27
|
-
* records.
|
|
28
|
-
* @returns The filter.
|
|
29
|
-
*/
|
|
30
|
-
export declare function getLevelFilter(level: LogLevel | null): Filter;
|
|
31
|
-
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/logtape/filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;AAElD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAGnD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,CAoB7D"}
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import type { LogLevel } from "./level.js";
|
|
2
|
-
import type { LogRecord } from "./record.js";
|
|
3
|
-
/**
|
|
4
|
-
* A text formatter is a function that accepts a log record and returns
|
|
5
|
-
* a string.
|
|
6
|
-
*
|
|
7
|
-
* @param record The log record to format.
|
|
8
|
-
* @returns The formatted log record.
|
|
9
|
-
*/
|
|
10
|
-
export type TextFormatter = (record: LogRecord) => string;
|
|
11
|
-
/**
|
|
12
|
-
* The formatted values for a log record.
|
|
13
|
-
* @since 0.6.0
|
|
14
|
-
*/
|
|
15
|
-
export interface FormattedValues {
|
|
16
|
-
/**
|
|
17
|
-
* The formatted timestamp.
|
|
18
|
-
*/
|
|
19
|
-
timestamp: string;
|
|
20
|
-
/**
|
|
21
|
-
* The formatted log level.
|
|
22
|
-
*/
|
|
23
|
-
level: string;
|
|
24
|
-
/**
|
|
25
|
-
* The formatted category.
|
|
26
|
-
*/
|
|
27
|
-
category: string;
|
|
28
|
-
/**
|
|
29
|
-
* The formatted message.
|
|
30
|
-
*/
|
|
31
|
-
message: string;
|
|
32
|
-
/**
|
|
33
|
-
* The unformatted log record.
|
|
34
|
-
*/
|
|
35
|
-
record: LogRecord;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* The various options for the built-in text formatters.
|
|
39
|
-
* @since 0.6.0
|
|
40
|
-
*/
|
|
41
|
-
export interface TextFormatterOptions {
|
|
42
|
-
/**
|
|
43
|
-
* The timestamp format. This can be one of the following:
|
|
44
|
-
*
|
|
45
|
-
* - `"date-time-timezone"`: The date and time with the full timezone offset
|
|
46
|
-
* (e.g., `"2023-11-14 22:13:20.000 +00:00"`).
|
|
47
|
-
* - `"date-time-tz"`: The date and time with the short timezone offset
|
|
48
|
-
* (e.g., `"2023-11-14 22:13:20.000 +00"`).
|
|
49
|
-
* - `"date-time"`: The date and time without the timezone offset
|
|
50
|
-
* (e.g., `"2023-11-14 22:13:20.000"`).
|
|
51
|
-
* - `"time-timezone"`: The time with the full timezone offset but without
|
|
52
|
-
* the date (e.g., `"22:13:20.000 +00:00"`).
|
|
53
|
-
* - `"time-tz"`: The time with the short timezone offset but without the date
|
|
54
|
-
* (e.g., `"22:13:20.000 +00"`).
|
|
55
|
-
* - `"time"`: The time without the date or timezone offset
|
|
56
|
-
* (e.g., `"22:13:20.000"`).
|
|
57
|
-
* - `"date"`: The date without the time or timezone offset
|
|
58
|
-
* (e.g., `"2023-11-14"`).
|
|
59
|
-
* - `"rfc3339"`: The date and time in RFC 3339 format
|
|
60
|
-
* (e.g., `"2023-11-14T22:13:20.000Z"`).
|
|
61
|
-
*
|
|
62
|
-
* Alternatively, this can be a function that accepts a timestamp and returns
|
|
63
|
-
* a string.
|
|
64
|
-
*
|
|
65
|
-
* The default is `"date-time-timezone"`.
|
|
66
|
-
*/
|
|
67
|
-
timestamp?: "date-time-timezone" | "date-time-tz" | "date-time" | "time-timezone" | "time-tz" | "time" | "date" | "rfc3339" | ((ts: number) => string);
|
|
68
|
-
/**
|
|
69
|
-
* The log level format. This can be one of the following:
|
|
70
|
-
*
|
|
71
|
-
* - `"ABBR"`: The log level abbreviation in uppercase (e.g., `"INF"`).
|
|
72
|
-
* - `"FULL"`: The full log level name in uppercase (e.g., `"INFO"`).
|
|
73
|
-
* - `"L"`: The first letter of the log level in uppercase (e.g., `"I"`).
|
|
74
|
-
* - `"abbr"`: The log level abbreviation in lowercase (e.g., `"inf"`).
|
|
75
|
-
* - `"full"`: The full log level name in lowercase (e.g., `"info"`).
|
|
76
|
-
* - `"l"`: The first letter of the log level in lowercase (e.g., `"i"`).
|
|
77
|
-
*
|
|
78
|
-
* Alternatively, this can be a function that accepts a log level and returns
|
|
79
|
-
* a string.
|
|
80
|
-
*
|
|
81
|
-
* The default is `"ABBR"`.
|
|
82
|
-
*/
|
|
83
|
-
level?: "ABBR" | "FULL" | "L" | "abbr" | "full" | "l" | ((level: LogLevel) => string);
|
|
84
|
-
/**
|
|
85
|
-
* The separator between category names. For example, if the separator is
|
|
86
|
-
* `"·"`, the category `["a", "b", "c"]` will be formatted as `"a·b·c"`.
|
|
87
|
-
* The default separator is `"·"`.
|
|
88
|
-
*
|
|
89
|
-
* If this is a function, it will be called with the category array and
|
|
90
|
-
* should return a string, which will be used for rendering the category.
|
|
91
|
-
*/
|
|
92
|
-
category?: string | ((category: readonly string[]) => string);
|
|
93
|
-
/**
|
|
94
|
-
* The format of the embedded values.
|
|
95
|
-
*
|
|
96
|
-
* A function that renders a value to a string. This function is used to
|
|
97
|
-
* render the values in the log record. The default is [`util.inspect()`] in
|
|
98
|
-
* Node.js/Bun and [`Deno.inspect()`] in Deno.
|
|
99
|
-
*
|
|
100
|
-
* [`util.inspect()`]: https://nodejs.org/api/util.html#utilinspectobject-options
|
|
101
|
-
* [`Deno.inspect()`]: https://docs.deno.com/api/deno/~/Deno.inspect
|
|
102
|
-
* @param value The value to render.
|
|
103
|
-
* @returns The string representation of the value.
|
|
104
|
-
*/
|
|
105
|
-
value?: (value: unknown) => string;
|
|
106
|
-
/**
|
|
107
|
-
* How those formatted parts are concatenated.
|
|
108
|
-
*
|
|
109
|
-
* A function that formats the log record. This function is called with the
|
|
110
|
-
* formatted values and should return a string. Note that the formatted
|
|
111
|
-
* *should not* include a newline character at the end.
|
|
112
|
-
*
|
|
113
|
-
* By default, this is a function that formats the log record as follows:
|
|
114
|
-
*
|
|
115
|
-
* ```
|
|
116
|
-
* 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!
|
|
117
|
-
* ```
|
|
118
|
-
* @param values The formatted values.
|
|
119
|
-
* @returns The formatted log record.
|
|
120
|
-
*/
|
|
121
|
-
format?: (values: FormattedValues) => string;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Get a text formatter with the specified options. Although it's flexible
|
|
125
|
-
* enough to create a custom formatter, if you want more control, you can
|
|
126
|
-
* create a custom formatter that satisfies the {@link TextFormatter} type
|
|
127
|
-
* instead.
|
|
128
|
-
*
|
|
129
|
-
* For more information on the options, see {@link TextFormatterOptions}.
|
|
130
|
-
*
|
|
131
|
-
* By default, the formatter formats log records as follows:
|
|
132
|
-
*
|
|
133
|
-
* ```
|
|
134
|
-
* 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!
|
|
135
|
-
* ```
|
|
136
|
-
* @param options The options for the text formatter.
|
|
137
|
-
* @returns The text formatter.
|
|
138
|
-
* @since 0.6.0
|
|
139
|
-
*/
|
|
140
|
-
export declare function getTextFormatter(options?: TextFormatterOptions): TextFormatter;
|
|
141
|
-
/**
|
|
142
|
-
* The default text formatter. This formatter formats log records as follows:
|
|
143
|
-
*
|
|
144
|
-
* ```
|
|
145
|
-
* 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @param record The log record to format.
|
|
149
|
-
* @returns The formatted log record.
|
|
150
|
-
*/
|
|
151
|
-
export declare const defaultTextFormatter: TextFormatter;
|
|
152
|
-
/**
|
|
153
|
-
* The ANSI colors. These can be used to colorize text in the console.
|
|
154
|
-
* @since 0.6.0
|
|
155
|
-
*/
|
|
156
|
-
export type AnsiColor = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white";
|
|
157
|
-
/**
|
|
158
|
-
* The ANSI text styles.
|
|
159
|
-
* @since 0.6.0
|
|
160
|
-
*/
|
|
161
|
-
export type AnsiStyle = "bold" | "dim" | "italic" | "underline" | "strikethrough";
|
|
162
|
-
/**
|
|
163
|
-
* The various options for the ANSI color formatter.
|
|
164
|
-
* @since 0.6.0
|
|
165
|
-
*/
|
|
166
|
-
export interface AnsiColorFormatterOptions extends TextFormatterOptions {
|
|
167
|
-
/**
|
|
168
|
-
* The timestamp format. This can be one of the following:
|
|
169
|
-
*
|
|
170
|
-
* - `"date-time-timezone"`: The date and time with the full timezone offset
|
|
171
|
-
* (e.g., `"2023-11-14 22:13:20.000 +00:00"`).
|
|
172
|
-
* - `"date-time-tz"`: The date and time with the short timezone offset
|
|
173
|
-
* (e.g., `"2023-11-14 22:13:20.000 +00"`).
|
|
174
|
-
* - `"date-time"`: The date and time without the timezone offset
|
|
175
|
-
* (e.g., `"2023-11-14 22:13:20.000"`).
|
|
176
|
-
* - `"time-timezone"`: The time with the full timezone offset but without
|
|
177
|
-
* the date (e.g., `"22:13:20.000 +00:00"`).
|
|
178
|
-
* - `"time-tz"`: The time with the short timezone offset but without the date
|
|
179
|
-
* (e.g., `"22:13:20.000 +00"`).
|
|
180
|
-
* - `"time"`: The time without the date or timezone offset
|
|
181
|
-
* (e.g., `"22:13:20.000"`).
|
|
182
|
-
* - `"date"`: The date without the time or timezone offset
|
|
183
|
-
* (e.g., `"2023-11-14"`).
|
|
184
|
-
* - `"rfc3339"`: The date and time in RFC 3339 format
|
|
185
|
-
* (e.g., `"2023-11-14T22:13:20.000Z"`).
|
|
186
|
-
*
|
|
187
|
-
* Alternatively, this can be a function that accepts a timestamp and returns
|
|
188
|
-
* a string.
|
|
189
|
-
*
|
|
190
|
-
* The default is `"date-time-tz"`.
|
|
191
|
-
*/
|
|
192
|
-
timestamp?: "date-time-timezone" | "date-time-tz" | "date-time" | "time-timezone" | "time-tz" | "time" | "date" | "rfc3339" | ((ts: number) => string);
|
|
193
|
-
/**
|
|
194
|
-
* The ANSI style for the timestamp. `"dim"` is used by default.
|
|
195
|
-
*/
|
|
196
|
-
timestampStyle?: AnsiStyle | null;
|
|
197
|
-
/**
|
|
198
|
-
* The ANSI color for the timestamp. No color is used by default.
|
|
199
|
-
*/
|
|
200
|
-
timestampColor?: AnsiColor | null;
|
|
201
|
-
/**
|
|
202
|
-
* The ANSI style for the log level. `"bold"` is used by default.
|
|
203
|
-
*/
|
|
204
|
-
levelStyle?: AnsiStyle | null;
|
|
205
|
-
/**
|
|
206
|
-
* The ANSI colors for the log levels. The default colors are as follows:
|
|
207
|
-
*
|
|
208
|
-
* - `"debug"`: `"blue"`
|
|
209
|
-
* - `"info"`: `"green"`
|
|
210
|
-
* - `"warning"`: `"yellow"`
|
|
211
|
-
* - `"error"`: `"red"`
|
|
212
|
-
* - `"fatal"`: `"magenta"`
|
|
213
|
-
*/
|
|
214
|
-
levelColors?: Record<LogLevel, AnsiColor | null>;
|
|
215
|
-
/**
|
|
216
|
-
* The ANSI style for the category. `"dim"` is used by default.
|
|
217
|
-
*/
|
|
218
|
-
categoryStyle?: AnsiStyle | null;
|
|
219
|
-
/**
|
|
220
|
-
* The ANSI color for the category. No color is used by default.
|
|
221
|
-
*/
|
|
222
|
-
categoryColor?: AnsiColor | null;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Get an ANSI color formatter with the specified options.
|
|
226
|
-
*
|
|
227
|
-
* 
|
|
228
|
-
* @param option The options for the ANSI color formatter.
|
|
229
|
-
* @returns The ANSI color formatter.
|
|
230
|
-
* @since 0.6.0
|
|
231
|
-
*/
|
|
232
|
-
export declare function getAnsiColorFormatter(options?: AnsiColorFormatterOptions): TextFormatter;
|
|
233
|
-
/**
|
|
234
|
-
* A text formatter that uses ANSI colors to format log records.
|
|
235
|
-
*
|
|
236
|
-
* 
|
|
237
|
-
*
|
|
238
|
-
* @param record The log record to format.
|
|
239
|
-
* @returns The formatted log record.
|
|
240
|
-
* @since 0.5.0
|
|
241
|
-
*/
|
|
242
|
-
export declare const ansiColorFormatter: TextFormatter;
|
|
243
|
-
/**
|
|
244
|
-
* A console formatter is a function that accepts a log record and returns
|
|
245
|
-
* an array of arguments to pass to {@link console.log}.
|
|
246
|
-
*
|
|
247
|
-
* @param record The log record to format.
|
|
248
|
-
* @returns The formatted log record, as an array of arguments for
|
|
249
|
-
* {@link console.log}.
|
|
250
|
-
*/
|
|
251
|
-
export type ConsoleFormatter = (record: LogRecord) => readonly unknown[];
|
|
252
|
-
/**
|
|
253
|
-
* The default console formatter.
|
|
254
|
-
*
|
|
255
|
-
* @param record The log record to format.
|
|
256
|
-
* @returns The formatted log record, as an array of arguments for
|
|
257
|
-
* {@link console.log}.
|
|
258
|
-
*/
|
|
259
|
-
export declare function defaultConsoleFormatter(record: LogRecord): readonly unknown[];
|
|
260
|
-
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/logtape/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,MAAM,CAAC;AAmD1D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,EAAE,SAAS,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,CAAC,EACN,oBAAoB,GACpB,cAAc,GACd,WAAW,GACX,eAAe,GACf,SAAS,GACT,MAAM,GACN,MAAM,GACN,SAAS,GACT,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAE7B;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,EACF,MAAM,GACN,MAAM,GACN,GAAG,GACH,MAAM,GACN,MAAM,GACN,GAAG,GACH,CAAC,CAAC,KAAK,EAAE,QAAQ,KAAK,MAAM,CAAC,CAAC;IAElC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,KAAK,MAAM,CAAC,CAAC;IAE9D;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;IAEnC;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,MAAM,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,oBAAyB,GACjC,aAAa,CA+Df;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAkC,CAAC;AAItE;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,GACN,SAAS,GACT,MAAM,GACN,OAAO,CAAC;AAaZ;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,KAAK,GACL,QAAQ,GACR,WAAW,GACX,eAAe,CAAC;AAkBpB;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACrE;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,CAAC,EACN,oBAAoB,GACpB,cAAc,GACd,WAAW,GACX,eAAe,GACf,SAAS,GACT,MAAM,GACN,MAAM,GACN,SAAS,GACT,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAE7B;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAElC;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAElC;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAE9B;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAC,CAAC;IAEjD;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,yBAA8B,GACtC,aAAa,CAiDf;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAuC,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,OAAO,EAAE,CAAC;AAazE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,OAAO,EAAE,CA2B7E"}
|
package/types/logtape/level.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
declare const logLevels: readonly ["debug", "info", "warning", "error", "fatal"];
|
|
2
|
-
/**
|
|
3
|
-
* The severity level of a {@link LogRecord}.
|
|
4
|
-
*/
|
|
5
|
-
export type LogLevel = typeof logLevels[number];
|
|
6
|
-
/**
|
|
7
|
-
* Parses a log level from a string.
|
|
8
|
-
*
|
|
9
|
-
* @param level The log level as a string. This is case-insensitive.
|
|
10
|
-
* @returns The log level.
|
|
11
|
-
* @throws {TypeError} If the log level is invalid.
|
|
12
|
-
*/
|
|
13
|
-
export declare function parseLogLevel(level: string): LogLevel;
|
|
14
|
-
/**
|
|
15
|
-
* Checks if a string is a valid log level. This function can be used as
|
|
16
|
-
* as a type guard to narrow the type of a string to a {@link LogLevel}.
|
|
17
|
-
*
|
|
18
|
-
* @param level The log level as a string. This is case-sensitive.
|
|
19
|
-
* @returns `true` if the string is a valid log level.
|
|
20
|
-
*/
|
|
21
|
-
export declare function isLogLevel(level: string): level is LogLevel;
|
|
22
|
-
/**
|
|
23
|
-
* Compares two log levels.
|
|
24
|
-
* @param a The first log level.
|
|
25
|
-
* @param b The second log level.
|
|
26
|
-
* @returns A negative number if `a` is less than `b`, a positive number if `a`
|
|
27
|
-
* is greater than `b`, or zero if they are equal.
|
|
28
|
-
* @since 0.8.0
|
|
29
|
-
*/
|
|
30
|
-
export declare function compareLogLevel(a: LogLevel, b: LogLevel): number;
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=level.d.ts.map
|