@warlock.js/logger 5.30.0 → 5.32.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/CHANGELOG.md +32 -5
- package/README.md +8 -11
- package/cjs/index.cjs +339 -31
- package/cjs/index.cjs.map +1 -1
- package/esm/channels/console-log.d.mts +2 -4
- package/esm/channels/console-log.d.mts.map +1 -1
- package/esm/channels/console-log.mjs.map +1 -1
- package/esm/channels/file-log.d.mts +130 -15
- package/esm/channels/file-log.d.mts.map +1 -1
- package/esm/channels/file-log.mjs +204 -23
- package/esm/channels/file-log.mjs.map +1 -1
- package/esm/channels/file-name-pattern.d.mts +15 -0
- package/esm/channels/file-name-pattern.d.mts.map +1 -0
- package/esm/channels/file-name-pattern.mjs +41 -0
- package/esm/channels/file-name-pattern.mjs.map +1 -0
- package/esm/channels/index.mjs +2 -2
- package/esm/channels/json-file-log.d.mts +1 -3
- package/esm/channels/json-file-log.d.mts.map +1 -1
- package/esm/channels/json-file-log.mjs +24 -5
- package/esm/channels/json-file-log.mjs.map +1 -1
- package/esm/channels/sentry-log.d.mts +7 -8
- package/esm/channels/sentry-log.d.mts.map +1 -1
- package/esm/channels/sentry-log.mjs.map +1 -1
- package/esm/index.d.mts +5 -3
- package/esm/index.mjs +3 -2
- package/esm/log-channel.d.mts +23 -3
- package/esm/log-channel.d.mts.map +1 -1
- package/esm/log-channel.mjs +22 -0
- package/esm/log-channel.mjs.map +1 -1
- package/esm/logger.d.mts +8 -5
- package/esm/logger.d.mts.map +1 -1
- package/esm/logger.mjs +12 -3
- package/esm/logger.mjs.map +1 -1
- package/esm/redact/default-keys.d.mts +3 -4
- package/esm/redact/default-keys.d.mts.map +1 -1
- package/esm/redact/escape-log-value.d.mts +25 -0
- package/esm/redact/escape-log-value.d.mts.map +1 -0
- package/esm/redact/escape-log-value.mjs +37 -0
- package/esm/redact/escape-log-value.mjs.map +1 -0
- package/esm/redact/index.mjs +2 -1
- package/esm/redact/mask-email.d.mts +3 -4
- package/esm/redact/mask-email.d.mts.map +1 -1
- package/esm/redact/redact.d.mts +3 -5
- package/esm/redact/redact.d.mts.map +1 -1
- package/esm/redact/redact.mjs.map +1 -1
- package/esm/types.d.mts +14 -14
- package/esm/types.d.mts.map +1 -1
- package/esm/utils/capture-unhandled-errors.d.mts +2 -3
- package/esm/utils/capture-unhandled-errors.d.mts.map +1 -1
- package/esm/utils/clear-message.d.mts +1 -2
- package/esm/utils/clear-message.d.mts.map +1 -1
- package/esm/utils/index.mjs +1 -1
- package/esm/utils/safe-json-stringify.d.mts +1 -2
- package/esm/utils/safe-json-stringify.d.mts.map +1 -1
- package/llms-full.txt +241 -141
- package/llms.txt +2 -2
- package/package.json +2 -2
- package/skills/capture-unhandled-errors/SKILL.md +9 -10
- package/skills/configure-logger/SKILL.md +7 -10
- package/skills/filter-log-entries/SKILL.md +2 -2
- package/skills/flush-logs-on-shutdown/SKILL.md +32 -13
- package/skills/index.md +4 -1
- package/skills/logger-basics/SKILL.md +18 -21
- package/skills/overview/SKILL.md +17 -6
- package/skills/pick-log-channel/SKILL.md +36 -24
- package/skills/redact-sensitive-log-fields/SKILL.md +48 -18
- package/skills/ship-logs-to-sentry/SKILL.md +18 -18
- package/skills/test-logging-code/SKILL.md +4 -2
- package/skills/write-custom-log-channel/SKILL.md +50 -17
package/esm/types.d.mts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - `error` — handled failure; the app continues
|
|
9
9
|
* - `fatal` — unrecoverable failure; the app is going down
|
|
10
10
|
*/
|
|
11
|
-
type LogLevel = "debug" | "info" | "warn" | "error" | "success" | "fatal";
|
|
11
|
+
export type LogLevel = "debug" | "info" | "warn" | "error" | "success" | "fatal";
|
|
12
12
|
/**
|
|
13
13
|
* Process-level events that `Logger.enableAutoFlush()` can hook to drain
|
|
14
14
|
* buffered channels before the process terminates.
|
|
@@ -17,14 +17,14 @@ type LogLevel = "debug" | "info" | "warn" | "error" | "success" | "fatal";
|
|
|
17
17
|
* then re-raised so Node's default exit behavior runs.
|
|
18
18
|
* - `beforeExit` is flushed in place — Node exits on its own afterwards.
|
|
19
19
|
*/
|
|
20
|
-
type AutoFlushEvent = "SIGINT" | "SIGTERM" | "SIGHUP" | "SIGBREAK" | "SIGUSR2" | "beforeExit";
|
|
21
|
-
type DebugMode = "daily" | "monthly" | "yearly" | "hourly";
|
|
20
|
+
export type AutoFlushEvent = "SIGINT" | "SIGTERM" | "SIGHUP" | "SIGBREAK" | "SIGUSR2" | "beforeExit";
|
|
21
|
+
export type DebugMode = "daily" | "monthly" | "yearly" | "hourly";
|
|
22
22
|
/**
|
|
23
23
|
* Replacement value used by `RedactConfig`. Either a literal string
|
|
24
24
|
* (e.g. `"[REDACTED]"`) or a function that receives the original value plus
|
|
25
25
|
* the dotted path it sits at and returns whatever should replace it.
|
|
26
26
|
*/
|
|
27
|
-
type RedactCensor = string | ((value: any, path: string) => any);
|
|
27
|
+
export type RedactCensor = string | ((value: any, path: string) => any);
|
|
28
28
|
/**
|
|
29
29
|
* Strip sensitive fields from log entries before they reach a channel.
|
|
30
30
|
*
|
|
@@ -62,7 +62,7 @@ type RedactCensor = string | ((value: any, path: string) => any);
|
|
|
62
62
|
* },
|
|
63
63
|
* });
|
|
64
64
|
*/
|
|
65
|
-
type RedactConfig = {
|
|
65
|
+
export type RedactConfig = {
|
|
66
66
|
/**
|
|
67
67
|
* Glob path patterns to redact. Paths are evaluated against the full
|
|
68
68
|
* `LoggingData` object — so prefix with `context.` or `message.` to scope
|
|
@@ -100,7 +100,7 @@ type RedactConfig = {
|
|
|
100
100
|
*/
|
|
101
101
|
censor?: RedactCensor;
|
|
102
102
|
};
|
|
103
|
-
type BasicLogConfigurations = {
|
|
103
|
+
export type BasicLogConfigurations = {
|
|
104
104
|
/**
|
|
105
105
|
* Set what level of logs should be logged
|
|
106
106
|
*
|
|
@@ -130,7 +130,7 @@ type BasicLogConfigurations = {
|
|
|
130
130
|
*/
|
|
131
131
|
redact?: RedactConfig;
|
|
132
132
|
};
|
|
133
|
-
type LogMessage = {
|
|
133
|
+
export type LogMessage = {
|
|
134
134
|
content: string;
|
|
135
135
|
level: LogLevel;
|
|
136
136
|
date: string;
|
|
@@ -140,7 +140,7 @@ type LogMessage = {
|
|
|
140
140
|
context?: Record<string, any>;
|
|
141
141
|
timestamp?: string;
|
|
142
142
|
};
|
|
143
|
-
interface LogContract {
|
|
143
|
+
export interface LogContract {
|
|
144
144
|
/**
|
|
145
145
|
* Channel name
|
|
146
146
|
*/
|
|
@@ -171,19 +171,19 @@ interface LogContract {
|
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* Receives a channel's delivery failure: a synchronous throw from its `log()`
|
|
174
|
-
* or a rejection of the promise it returned, a redaction that threw,
|
|
175
|
-
* `flush()` that timed out
|
|
174
|
+
* or a rejection of the promise it returned, a redaction that threw, a
|
|
175
|
+
* `flush()` that timed out, or a channel's own background failure (such as
|
|
176
|
+
* `FileLog` retention failing to remove a file). Set with `Logger.onChannelError()` or
|
|
176
177
|
* `configure({ onChannelError })`. It may be async; a rejection is swallowed.
|
|
177
178
|
*/
|
|
178
|
-
type ChannelErrorHandler = (error: unknown, channel: LogContract, entry: LoggingData) => void | Promise<void>;
|
|
179
|
-
type LoggingData = {
|
|
179
|
+
export type ChannelErrorHandler = (error: unknown, channel: LogContract, entry: LoggingData) => void | Promise<void>;
|
|
180
|
+
export type LoggingData = {
|
|
180
181
|
type: LogLevel;
|
|
181
182
|
module: string;
|
|
182
183
|
action: string;
|
|
183
184
|
message: any;
|
|
184
185
|
context?: Record<string, any>;
|
|
185
186
|
};
|
|
186
|
-
type OmittedLoggingData = Omit<LoggingData, "type">;
|
|
187
|
+
export type OmittedLoggingData = Omit<LoggingData, "type">;
|
|
187
188
|
//#endregion
|
|
188
|
-
export { AutoFlushEvent, BasicLogConfigurations, ChannelErrorHandler, DebugMode, LogContract, LogLevel, LogMessage, LoggingData, OmittedLoggingData, RedactCensor, RedactConfig };
|
|
189
189
|
//# sourceMappingURL=types.d.mts.map
|
package/esm/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../packages/logger/src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../packages/logger/src/types.ts"],"mappings":";;;;;;;;;;YASY;;;;;;;;;YAUA;YAQA;;;;;;YAOA,0BAA0B,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuCtC;;;;;;;;EAQV;;;;;;;EAOA;;;;;;;;;;;;;;;EAeA;;;;;;EAMA,SAAS;;YAGC;;;;;;EAMV,SAAS;;;;EAIT;IACE;IACA;;;;;EAKF,UAAU,MAAM;;;;EAIhB,WAAW,MAAM,gBAAgB,QAAQ;;;;;;;EAOzC,SAAS;;YAGC;EACV;EACA,OAAO;EACP;EACA;EACA;EACA;EACA,UAAU;EACV;;iBAGe;;;;EAIf;;;;EAKA;;;;EAKA;;;;EAKA,IAAI,MAAM,qBAAqB;;;;;;;EAQ/B,iBAAiB;;;;EAKjB;;;;;;;;;YAUU,uBACV,gBACA,SAAS,aACT,OAAO,uBACG;YAEA;EACV,MAAM;EACN;EACA;EACA;EACA,UAAU;;YAGA,qBAAqB,KAAK"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Options for {@link captureAnyUnhandledRejection}.
|
|
4
4
|
*/
|
|
5
|
-
type CaptureUnhandledOptions = {
|
|
5
|
+
export type CaptureUnhandledOptions = {
|
|
6
6
|
/**
|
|
7
7
|
* Take the process down with `process.exit(1)` after an `uncaughtException`
|
|
8
8
|
* is logged. Defaults to `true` — an uncaught exception leaves the process
|
|
@@ -41,7 +41,6 @@ type CaptureUnhandledOptions = {
|
|
|
41
41
|
* captureAnyUnhandledRejection(); // exits on uncaught
|
|
42
42
|
* captureAnyUnhandledRejection({ exitOnUncaughtException: false }); // dev: log only
|
|
43
43
|
*/
|
|
44
|
-
declare function captureAnyUnhandledRejection(options?: CaptureUnhandledOptions): void;
|
|
44
|
+
export declare function captureAnyUnhandledRejection(options?: CaptureUnhandledOptions): void;
|
|
45
45
|
//#endregion
|
|
46
|
-
export { CaptureUnhandledOptions, captureAnyUnhandledRejection };
|
|
47
46
|
//# sourceMappingURL=capture-unhandled-errors.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-unhandled-errors.d.mts","names":[],"sources":["../../../../../../../../packages/logger/src/utils/capture-unhandled-errors.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"capture-unhandled-errors.d.mts","names":[],"sources":["../../../../../../../../packages/logger/src/utils/capture-unhandled-errors.ts"],"mappings":";;;;YAKY;;;;;;;;;;;;;;EAcV;;;;;;;;;;;;;;;;;;;;;;;;;wBAkCc,6BAA6B,UAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-message.d.mts","names":[],"sources":["../../../../../../../../packages/logger/src/utils/clear-message.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"clear-message.d.mts","names":[],"sources":["../../../../../../../../packages/logger/src/utils/clear-message.ts"],"mappings":";;;;wBAGgB,aAAa"}
|
package/esm/utils/index.mjs
CHANGED
|
@@ -2,4 +2,4 @@ import { safeJsonStringify } from "./safe-json-stringify.mjs";
|
|
|
2
2
|
import { clearMessage } from "./clear-message.mjs";
|
|
3
3
|
import { captureAnyUnhandledRejection } from "./capture-unhandled-errors.mjs";
|
|
4
4
|
|
|
5
|
-
export {
|
|
5
|
+
export { captureAnyUnhandledRejection, clearMessage, safeJsonStringify };
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* @example
|
|
9
9
|
* await fs.promises.writeFile(filePath, safeJsonStringify(payload, 2));
|
|
10
10
|
*/
|
|
11
|
-
declare function safeJsonStringify(value: unknown, space?: number): string;
|
|
11
|
+
export declare function safeJsonStringify(value: unknown, space?: number): string;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { safeJsonStringify };
|
|
14
13
|
//# sourceMappingURL=safe-json-stringify.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-json-stringify.d.mts","names":[],"sources":["../../../../../../../../packages/logger/src/utils/safe-json-stringify.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"safe-json-stringify.d.mts","names":[],"sources":["../../../../../../../../packages/logger/src/utils/safe-json-stringify.ts"],"mappings":";;;;;;;;;;wBAyCgB,kBAAkB,gBAAgB"}
|