@rawnodes/logger 2.8.0 → 2.10.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/README.md CHANGED
@@ -136,16 +136,57 @@ This is useful for sending only critical errors to alerting systems while keepin
136
136
 
137
137
  #### Level precedence
138
138
 
139
- When deciding whether to emit a log entry, the following order applies **most specific wins**:
139
+ Each transport decides on its own whether to emit a given log entry. The precedence depends on whether the transport **respects runtime overrides** (see the next section):
140
140
 
141
- 1. **Global override** from `setLevelOverride(...)` or the top-level `level.rules` array
141
+ **When respecting overrides** (observability transports console/file/cloudwatch/relay by default):
142
+
143
+ 1. **Runtime override** from `setLevelOverride(...)` or the top-level `level.rules` array
142
144
  2. **Per-transport rule** (a matching entry in `console.rules` / `file.rules` / etc.)
143
145
  3. **Per-transport level** (`console.level`, `file.level`, …)
144
146
  4. **Global default level** (`level` or `level.default`)
145
147
 
146
- Practically: a matching `setLevelOverride({ userId: 123 }, 'debug')` will surface debug logs to **every** transport, even one whose own `level` is set to `info`. This is intentional dynamic overrides are for targeted troubleshooting, and they wouldn't be useful if a downstream transport could silently swallow the messages they just enabled.
148
+ **When ignoring overrides** (alert transportsdiscord/telegram/zohoCliq by default):
149
+
150
+ 1. **Per-transport rule**
151
+ 2. **Per-transport level**
152
+ 3. **Global default level**
153
+
154
+ Practically: a matching `setLevelOverride({ userId: 123 }, 'debug')` will surface debug logs to **viewing** transports (console/cloudwatch/file), even if their own `level` is set to `info`. But the same override will **not** leak through notification channels (discord/telegram/zohoCliq) unless you explicitly opt them in via `respectRuntimeOverrides: true`.
155
+
156
+ #### Transport roles (`respectRuntimeOverrides`)
157
+
158
+ Every transport config accepts an optional `respectRuntimeOverrides?: boolean` flag. Defaults:
159
+
160
+ | Transport | Default | Role |
161
+ |--------------|---------|---------------|
162
+ | `console` | `true` | observability |
163
+ | `file` | `true` | observability |
164
+ | `cloudwatch` | `true` | observability |
165
+ | `relay` | `true` | observability |
166
+ | `discord` | `false` | alert |
167
+ | `telegram` | `false` | alert |
168
+ | `zohoCliq` | `false` | alert |
169
+
170
+ The defaults reflect typical usage — console/file/cloudwatch are where operators look for logs during troubleshooting, while discord/telegram/zohoCliq are user-facing notification channels that should not get flooded by ad-hoc debug overrides. Override the default per-transport when needed:
147
171
 
148
- If you need a transport to stay narrow while overrides are active, use `rules` on that transport (level 2), not the plain `level` field.
172
+ ```typescript
173
+ const logger = Logger.create({
174
+ level: 'info',
175
+ console: { format: 'plain' },
176
+ telegram: {
177
+ botToken: '...',
178
+ chatId: '...',
179
+ level: 'warn',
180
+ respectRuntimeOverrides: true, // let overrides through (rare)
181
+ },
182
+ cloudwatch: {
183
+ logGroupName: '...',
184
+ level: 'info',
185
+ respectRuntimeOverrides: false, // strict gate even under troubleshooting (also rare)
186
+ region: '...', accessKeyId: '...', secretAccessKey: '...',
187
+ },
188
+ });
189
+ ```
149
190
 
150
191
  ### Per-Transport Rules
151
192
 
@@ -381,6 +422,39 @@ cloudwatch: {
381
422
  }
382
423
  ```
383
424
 
425
+ ### Relay (remote live-tail)
426
+
427
+ The relay transport runs in a worker thread, polls a config endpoint you control, and — when that endpoint returns `enabled: true` — opens a WebSocket and streams logs to it in real time. Lets you flip on live-tail debugging for a running prod service from a dashboard, without redeploying.
428
+
429
+ ```typescript
430
+ Logger.create({
431
+ level: 'info',
432
+ console: { format: 'json' },
433
+ relay: {
434
+ apiUrl: 'https://relay.internal.company.com',
435
+ token: process.env.RELAY_TOKEN!,
436
+ maskSecrets: true, // mask before forwarding (recommended)
437
+ allowedWsHosts: ['ws.internal.company.com'], // only needed if WS host ≠ apiUrl host
438
+ },
439
+ });
440
+ ```
441
+
442
+ Server contract (`GET /api/relay/config` with `Authorization: Bearer <token>`):
443
+
444
+ ```jsonc
445
+ {
446
+ "enabled": true, // false = stop streaming, drop logs cheaply
447
+ "wsUrl": "wss://...", // WebSocket gateway to stream to
448
+ "rules": [{ "level": "debug", "context": "auth" }] // optional filters
449
+ }
450
+ ```
451
+
452
+ **Security defaults to know about:**
453
+
454
+ - **`wsUrl` is pinned to `apiUrl`'s origin by default.** A compromised config endpoint cannot redirect your logs to an arbitrary host. Use `allowedWsHosts` to authorize alternates explicitly.
455
+ - **`maskSecrets` does NOT inherit from the parent logger** — the relay runs in a worker thread and gets only the options you pass to its config. Pass it again here if you want forwarded logs masked. Off by default.
456
+ - The relay writes one stderr line on first successful WS open (`[RelayTransport] streaming logs to ...`) so the fact of streaming is auditable in your normal log output.
457
+
384
458
  ### Transport Options
385
459
 
386
460
  All external transports support:
@@ -627,26 +701,62 @@ getOrGenerateRequestId(req.headers); // always returns string
627
701
 
628
702
  ### Secret Masking
629
703
 
630
- Automatically masks sensitive fields in logs:
704
+ Two ways to use it: a **global flag** that masks every log automatically, or **manual utilities** when you want fine-grained control.
631
705
 
632
- ```typescript
633
- import { maskSecrets, createMasker } from '@rawnodes/logger';
706
+ #### Global flag (recommended)
707
+
708
+ Set `maskSecrets: true` in `Logger.create` to mask all output across console / file / CloudWatch / Discord / Telegram / Zoho Cliq. Backwards compatible — masking is **off by default**.
634
709
 
635
- maskSecrets({
636
- user: 'admin',
637
- password: 'secret123',
638
- apiKey: 'key_abc123',
710
+ ```typescript
711
+ const logger = Logger.create({
712
+ level: 'info',
713
+ console: { format: 'json' },
714
+ file: { format: 'json', dirname: './logs', filename: 'app.log' },
715
+ maskSecrets: true,
639
716
  });
640
- // { user: 'admin', password: '***', apiKey: '***' }
641
717
 
642
- // Custom masker
643
- const masker = createMasker({
644
- patterns: ['ssn', 'creditCard'],
645
- mask: '[REDACTED]'
718
+ logger.info('login', { user: 'alice', password: 'hunter2' });
719
+ // {"level":"info","message":"login","user":"alice","password":"***",...}
720
+
721
+ logger.info('connect', { url: 'https://u:p@db.example.com/foo' });
722
+ // URL credentials masked: "https://***:***@db.example.com/foo"
723
+ ```
724
+
725
+ Custom patterns / mask string:
726
+
727
+ ```typescript
728
+ Logger.create({
729
+ ...,
730
+ maskSecrets: {
731
+ patterns: ['ssn', 'creditCard'], // adds to defaults? NO — replaces them
732
+ mask: '[REDACTED]',
733
+ },
646
734
  });
647
735
  ```
648
736
 
649
- **Default masked patterns:** `password`, `secret`, `token`, `apikey`, `api_key`, `api-key`, `auth`, `credential`, `private`
737
+ **Default masked patterns:** `password`, `secret`, `token`, `apikey`, `api_key`, `api-key`, `auth`, `credential`, `private` (case-insensitive substring match on key names).
738
+
739
+ **Performance:** ~+2.5 µs per log call on a typical payload. Implemented via a `JSON.stringify` replacer for json/CloudWatch (zero clone) and a one-shot clone for HTTP transports that build markdown/embed payloads (Discord/Telegram/Zoho). For most services (< 10k logs/sec) the cost is invisible.
740
+
741
+ #### Manual utilities
742
+
743
+ If you only want to mask specific calls — or need a `JSON.stringify` replacer for your own serialization — three helpers are exported:
744
+
745
+ ```typescript
746
+ import { maskSecrets, createMasker, maskReplacer } from '@rawnodes/logger';
747
+
748
+ // One-shot: returns a deep-cloned masked object
749
+ maskSecrets({ user: 'admin', password: 'secret' });
750
+ // { user: 'admin', password: '***' }
751
+
752
+ // Reusable: pre-resolves options, slightly faster for repeated calls
753
+ const masker = createMasker({ patterns: ['ssn'], mask: '[REDACTED]' });
754
+ masker({ ssn: '123-45-6789' }); // { ssn: '[REDACTED]' }
755
+
756
+ // JSON.stringify replacer: zero allocations, masks during serialization
757
+ JSON.stringify(payload, maskReplacer());
758
+ JSON.stringify(payload, maskReplacer({ patterns: ['ssn'] }), 2);
759
+ ```
650
760
 
651
761
  ## Error logging
652
762
 
package/dist/index.d.mts CHANGED
@@ -1,222 +1,7 @@
1
+ import { L as LoggerContext, a as LoggerConfig, b as LevelOverrideMatch, c as LogLevel, d as LevelOverride, M as Meta, D as DiscordConfig, T as TelegramConfig, C as CloudWatchConfig, e as MaskReplacer, Z as ZohoCliqConfig, f as CallerConfig, g as CallerInfo, h as LogFormat, i as LevelRule, j as ConsoleConfig, F as FileConfig, H as HttpTransportBaseConfig, k as LevelConfigObject, l as LevelConfig, R as RelayConfig, A as AutoShutdownConfig, m as LogStreamPattern, n as LogStreamPatternConfig, o as LogStreamTemplateConfig, p as LogStreamName } from './types-lfJLhC8J.mjs';
2
+ export { q as LOG_LEVELS, x as MaskSecretsOptions, t as ZohoCliqBotConfig, s as assertLogLevel, v as createMasker, r as isValidLogLevel, w as maskReplacer, u as maskSecrets } from './types-lfJLhC8J.mjs';
1
3
  import { z } from 'zod';
2
4
 
3
- declare const LOG_LEVELS: {
4
- readonly off: -1;
5
- readonly error: 0;
6
- readonly warn: 1;
7
- readonly info: 2;
8
- readonly http: 3;
9
- readonly verbose: 4;
10
- readonly debug: 5;
11
- readonly silly: 6;
12
- };
13
- type LogLevel = keyof typeof LOG_LEVELS;
14
- declare function isValidLogLevel(level: string): level is LogLevel;
15
- declare function assertLogLevel(level: string): asserts level is LogLevel;
16
- type LogFormat = 'json' | 'plain' | 'logfmt' | 'simple';
17
- interface LevelRule {
18
- match: Record<string, unknown> & {
19
- context?: string;
20
- };
21
- level: LogLevel;
22
- }
23
- interface ConsoleConfig {
24
- format: LogFormat;
25
- level?: LogLevel;
26
- rules?: LevelRule[];
27
- }
28
- interface FileConfig {
29
- format: LogFormat;
30
- level?: LogLevel;
31
- rules?: LevelRule[];
32
- dirname: string;
33
- filename: string;
34
- datePattern?: string;
35
- interval?: string;
36
- zippedArchive?: boolean;
37
- maxSize?: string;
38
- maxFiles?: string;
39
- }
40
- interface HttpTransportBaseConfig {
41
- level?: LogLevel;
42
- rules?: LevelRule[];
43
- batchSize?: number;
44
- flushInterval?: number;
45
- maxRetries?: number;
46
- retryDelay?: number;
47
- /**
48
- * Maximum number of messages the in-memory queue will hold before dropping.
49
- * Provides a hard upper bound on memory usage when a transport is degraded
50
- * or offline — without this, a failing transport + steady log volume grows
51
- * the queue until OOM. Default: unbounded.
52
- *
53
- * Recommended for production: `10_000` — enough to absorb transient blips,
54
- * small enough to avoid runaway memory.
55
- */
56
- maxQueueSize?: number;
57
- /**
58
- * Policy applied when the queue is full.
59
- * - `'drop-oldest'` (default): prefers keeping recent events — during an
60
- * outage old logs are usually stale.
61
- * - `'drop-newest'`: prefers preserving historical context — useful if you
62
- * care more about the events leading up to the outage than the noise
63
- * happening during it.
64
- */
65
- dropPolicy?: 'drop-oldest' | 'drop-newest';
66
- /**
67
- * Called when messages are dropped due to queue overflow. Receives only the
68
- * messages that were discarded. If not provided, drops are silent.
69
- *
70
- * Callback MUST NOT throw; if it does, the exception is swallowed.
71
- */
72
- onDrop?: (droppedMessages: unknown[]) => void;
73
- /**
74
- * Called when a batch fails after all retries and messages are dropped.
75
- * If not provided, the error is logged to stderr.
76
- *
77
- * The callback MUST NOT throw; if it does, the failure is swallowed and a
78
- * stderr fallback is used. This is intentional — a logger must never
79
- * propagate its own transport errors back into the host application.
80
- */
81
- onError?: (error: Error, droppedMessages: unknown[]) => void;
82
- /**
83
- * Timeout in milliseconds for a single outbound HTTP request. Default:
84
- * `10_000`. Applies to Discord/Telegram `fetch`. CloudWatch uses the AWS
85
- * SDK's own timeout configuration.
86
- */
87
- requestTimeout?: number;
88
- }
89
- interface DiscordConfig extends HttpTransportBaseConfig {
90
- webhookUrl: string;
91
- format?: 'embed' | 'markdown';
92
- username?: string;
93
- avatarUrl?: string;
94
- embedColors?: Partial<Record<LogLevel, number>>;
95
- includeTimestamp?: boolean;
96
- includeMeta?: boolean;
97
- maxEmbedFields?: number;
98
- }
99
- interface TelegramConfig extends HttpTransportBaseConfig {
100
- botToken: string;
101
- chatId: string | number;
102
- parseMode?: 'Markdown' | 'MarkdownV2' | 'HTML';
103
- disableNotification?: boolean;
104
- threadId?: number;
105
- replyToMessageId?: number;
106
- }
107
- interface ZohoCliqBotConfig {
108
- /** Bot display name (shown in the channel). */
109
- name: string;
110
- /** Optional bot avatar URL. */
111
- image?: string;
112
- }
113
- interface ZohoCliqConfig extends HttpTransportBaseConfig {
114
- /**
115
- * Incoming webhook URL. If provided, `companyId`/`channel`/`region` are
116
- * ignored and this URL is used as-is (with `zapikey` appended as query).
117
- */
118
- webhookUrl?: string;
119
- /** Zoho Cliq company/org ID. Required unless `webhookUrl` is set. */
120
- companyId?: string;
121
- /** Target channel name (the `channelsbyname` API segment). Required unless `webhookUrl` is set. */
122
- channel?: string;
123
- /** Zoho region/TLD: 'eu' | 'com' | 'in' | etc. Default: 'eu'. */
124
- region?: string;
125
- /** Zoho API key (zapikey). Required. */
126
- apiKey: string;
127
- /** If true (default), message is posted as a broadcast so all members are notified. */
128
- broadcast?: boolean;
129
- /** Post as a custom bot instead of the default user. */
130
- bot?: ZohoCliqBotConfig;
131
- /** Include ISO timestamp in each formatted message. Default: true. */
132
- includeTimestamp?: boolean;
133
- /** Include meta as a fenced code block. Default: true. */
134
- includeMeta?: boolean;
135
- }
136
- type LogStreamPattern = 'hostname' | 'hostname-date' | 'hostname-uuid' | 'date' | 'uuid';
137
- interface LogStreamPatternConfig {
138
- pattern: LogStreamPattern;
139
- }
140
- interface LogStreamTemplateConfig {
141
- /** Custom template with variables: {hostname}, {date}, {datetime}, {uuid}, {pid}, {env} */
142
- template: string;
143
- }
144
- type LogStreamName = string | LogStreamPatternConfig | LogStreamTemplateConfig;
145
- interface RelayConfig {
146
- /** URL of the relay API (e.g., https://relay.example.com) */
147
- apiUrl: string;
148
- /** Authentication token for the relay server */
149
- token: string;
150
- /** Polling interval in ms (default: 30000) */
151
- pollInterval?: number;
152
- /** Ring buffer capacity - max logs held during reconnect (default: 1000) */
153
- bufferSize?: number;
154
- /** WebSocket reconnect base delay in ms (default: 1000) */
155
- reconnectDelay?: number;
156
- /** Max reconnect delay in ms (default: 30000) */
157
- maxReconnectDelay?: number;
158
- }
159
- interface CloudWatchConfig extends HttpTransportBaseConfig {
160
- logGroupName: string;
161
- /** Log stream name - string, pattern config, or template config. Defaults to hostname pattern */
162
- logStreamName?: LogStreamName;
163
- region: string;
164
- accessKeyId: string;
165
- secretAccessKey: string;
166
- createLogGroup?: boolean;
167
- createLogStream?: boolean;
168
- }
169
- interface LevelConfigObject {
170
- default: LogLevel;
171
- rules?: LevelRule[];
172
- }
173
- type LevelConfig = LogLevel | LevelConfigObject;
174
- interface CallerConfig {
175
- /** Stack depth to capture (default: 1). Higher values trace further up the call stack */
176
- depth?: number;
177
- /** Include full file path (default: false). If false, shows relative or basename only */
178
- fullPath?: boolean;
179
- }
180
- interface CallerInfo {
181
- file: string;
182
- line: number;
183
- column?: number;
184
- function?: string;
185
- }
186
- interface AutoShutdownConfig {
187
- /** Timeout in ms before forcing exit (default: 5000) */
188
- timeout?: number;
189
- /** Custom signals to handle (default: ['SIGTERM', 'SIGINT']) */
190
- signals?: NodeJS.Signals[];
191
- }
192
- interface LoggerConfig {
193
- level: LevelConfig;
194
- console: ConsoleConfig;
195
- file?: FileConfig;
196
- discord?: DiscordConfig | DiscordConfig[];
197
- telegram?: TelegramConfig | TelegramConfig[];
198
- cloudwatch?: CloudWatchConfig | CloudWatchConfig[];
199
- zohoCliq?: ZohoCliqConfig | ZohoCliqConfig[];
200
- /** Relay transport config — streams logs to a remote server via WebSocket (runs in worker thread) */
201
- relay?: RelayConfig;
202
- /** Enable caller info (file:line) in logs. Pass true for defaults or CallerConfig for options */
203
- caller?: boolean | CallerConfig;
204
- /** Hostname to include in all log entries. Defaults to os.hostname() if not specified */
205
- hostname?: string;
206
- /** Auto-register graceful shutdown handlers. Pass true for defaults or config object */
207
- autoShutdown?: boolean | AutoShutdownConfig;
208
- }
209
- type LoggerContext = Record<string, unknown>;
210
- type LevelOverrideMatch<TContext extends LoggerContext> = Partial<TContext> & {
211
- context?: string;
212
- };
213
- interface LevelOverride<TContext extends LoggerContext> {
214
- match: LevelOverrideMatch<TContext>;
215
- level: LogLevel;
216
- readonly?: boolean;
217
- }
218
- type Meta = object | (() => object);
219
-
220
5
  declare class LoggerStore<TContext extends LoggerContext = LoggerContext> {
221
6
  private storage;
222
7
  getStore(): TContext | undefined;
@@ -365,10 +150,19 @@ interface BaseHttpTransportOptions {
365
150
  * back into the host application.
366
151
  */
367
152
  onError?: (error: Error, droppedMessages: BufferedMessage[]) => void;
153
+ /**
154
+ * If provided, applied to `meta` once per message in `transformMessage`. Used
155
+ * by transports that build payloads via `Object.entries(meta)` iteration
156
+ * (Discord/Telegram/Zoho), where a JSON.stringify replacer can't reach the
157
+ * top-level key. CloudWatch passes `undefined` here and uses a replacer in
158
+ * its own `sendBatch` instead.
159
+ */
160
+ masker?: (value: unknown) => unknown;
368
161
  }
369
162
  declare abstract class BaseHttpTransport {
370
163
  protected buffer: MessageBuffer;
371
164
  private onErrorCallback?;
165
+ private masker?;
372
166
  constructor(opts?: BaseHttpTransportOptions);
373
167
  log(info: Record<string, unknown>, callback: () => void): void;
374
168
  /**
@@ -394,7 +188,7 @@ declare function matchesContext(storeContext: LoggerContext | undefined, loggerC
394
188
  declare class DiscordTransport extends BaseHttpTransport {
395
189
  private config;
396
190
  private requestTimeout;
397
- constructor(config: DiscordConfig);
191
+ constructor(config: DiscordConfig, masker?: (value: unknown) => unknown);
398
192
  protected sendBatch(messages: BufferedMessage[]): Promise<void>;
399
193
  private sendEmbedBatch;
400
194
  private sendMarkdownBatch;
@@ -410,7 +204,7 @@ declare class TelegramTransport extends BaseHttpTransport {
410
204
  private config;
411
205
  private apiUrl;
412
206
  private requestTimeout;
413
- constructor(config: TelegramConfig);
207
+ constructor(config: TelegramConfig, masker?: (value: unknown) => unknown);
414
208
  protected sendBatch(messages: BufferedMessage[]): Promise<void>;
415
209
  private formatBatchMessage;
416
210
  private formatMarkdown;
@@ -428,7 +222,8 @@ declare class CloudWatchTransport extends BaseHttpTransport {
428
222
  private initialized;
429
223
  private initPromise;
430
224
  private resolvedLogStreamName;
431
- constructor(config: CloudWatchConfig, configHostname?: string);
225
+ private maskReplacer;
226
+ constructor(config: CloudWatchConfig, configHostname?: string, maskReplacerFn?: MaskReplacer);
432
227
  protected sendBatch(messages: BufferedMessage[]): Promise<void>;
433
228
  private ensureInitialized;
434
229
  private initialize;
@@ -443,7 +238,7 @@ declare class ZohoCliqTransport extends BaseHttpTransport {
443
238
  private config;
444
239
  private endpoint;
445
240
  private requestTimeout;
446
- constructor(config: ZohoCliqConfig);
241
+ constructor(config: ZohoCliqConfig, masker?: (value: unknown) => unknown);
447
242
  private buildEndpoint;
448
243
  protected sendBatch(messages: BufferedMessage[]): Promise<void>;
449
244
  private formatMessage;
@@ -473,14 +268,6 @@ declare function generateRequestId(options?: RequestIdOptions): string;
473
268
  declare function extractRequestId(headers: Record<string, string | string[] | undefined>): string | undefined;
474
269
  declare function getOrGenerateRequestId(headers: Record<string, string | string[] | undefined>, options?: RequestIdOptions): string;
475
270
 
476
- interface MaskSecretsOptions {
477
- patterns?: string[];
478
- mask?: string;
479
- deep?: boolean;
480
- }
481
- declare function maskSecrets(obj: unknown, options?: MaskSecretsOptions): unknown;
482
- declare function createMasker(options?: MaskSecretsOptions): (obj: unknown) => unknown;
483
-
484
271
  declare function getCallerInfo(config: CallerConfig, additionalOffset?: number): CallerInfo | undefined;
485
272
  declare function formatCallerInfo(info: CallerInfo): string;
486
273
 
@@ -580,6 +367,7 @@ declare const CloudWatchConfigSchema: z.ZodType<CloudWatchConfig>;
580
367
  declare const ZohoCliqConfigSchema: z.ZodObject<{
581
368
  level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
582
369
  rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
370
+ respectRuntimeOverrides: z.ZodOptional<z.ZodBoolean>;
583
371
  batchSize: z.ZodOptional<z.ZodNumber>;
584
372
  flushInterval: z.ZodOptional<z.ZodNumber>;
585
373
  maxRetries: z.ZodOptional<z.ZodNumber>;
@@ -620,6 +408,7 @@ declare const LoggerConfigSchema: z.ZodObject<{
620
408
  zohoCliq: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
621
409
  level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
622
410
  rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
411
+ respectRuntimeOverrides: z.ZodOptional<z.ZodBoolean>;
623
412
  batchSize: z.ZodOptional<z.ZodNumber>;
624
413
  flushInterval: z.ZodOptional<z.ZodNumber>;
625
414
  maxRetries: z.ZodOptional<z.ZodNumber>;
@@ -647,6 +436,7 @@ declare const LoggerConfigSchema: z.ZodObject<{
647
436
  }, z.core.$strip>, z.ZodArray<z.ZodObject<{
648
437
  level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
649
438
  rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
439
+ respectRuntimeOverrides: z.ZodOptional<z.ZodBoolean>;
650
440
  batchSize: z.ZodOptional<z.ZodNumber>;
651
441
  flushInterval: z.ZodOptional<z.ZodNumber>;
652
442
  maxRetries: z.ZodOptional<z.ZodNumber>;
@@ -676,6 +466,11 @@ declare const LoggerConfigSchema: z.ZodObject<{
676
466
  caller: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodType<CallerConfig, unknown, z.core.$ZodTypeInternals<CallerConfig, unknown>>]>>;
677
467
  hostname: z.ZodOptional<z.ZodString>;
678
468
  autoShutdown: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodType<AutoShutdownConfig, unknown, z.core.$ZodTypeInternals<AutoShutdownConfig, unknown>>]>>;
469
+ maskSecrets: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
470
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
471
+ mask: z.ZodOptional<z.ZodString>;
472
+ deep: z.ZodOptional<z.ZodBoolean>;
473
+ }, z.core.$strip>]>>;
679
474
  }, z.core.$strip>;
680
475
  declare function validateConfig(config: unknown): z.infer<typeof LoggerConfigSchema>;
681
476
  declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
@@ -691,6 +486,7 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
691
486
  apiKey: string;
692
487
  level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
693
488
  rules?: LevelRule[] | undefined;
489
+ respectRuntimeOverrides?: boolean | undefined;
694
490
  batchSize?: number | undefined;
695
491
  flushInterval?: number | undefined;
696
492
  maxRetries?: number | undefined;
@@ -715,6 +511,7 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
715
511
  apiKey: string;
716
512
  level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
717
513
  rules?: LevelRule[] | undefined;
514
+ respectRuntimeOverrides?: boolean | undefined;
718
515
  batchSize?: number | undefined;
719
516
  flushInterval?: number | undefined;
720
517
  maxRetries?: number | undefined;
@@ -738,6 +535,11 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
738
535
  caller?: boolean | CallerConfig | undefined;
739
536
  hostname?: string | undefined;
740
537
  autoShutdown?: boolean | AutoShutdownConfig | undefined;
538
+ maskSecrets?: boolean | {
539
+ patterns?: string[] | undefined;
540
+ mask?: string | undefined;
541
+ deep?: boolean | undefined;
542
+ } | undefined;
741
543
  }>;
742
544
 
743
- export { type AutoShutdownConfig, AutoShutdownConfigSchema, BaseHttpTransport, type BaseHttpTransportOptions, type BufferOptions, type BufferedMessage, type CallerConfig, CallerConfigSchema, type CallerInfo, type CloudWatchConfig, CloudWatchConfigSchema, CloudWatchTransport, type ConsoleConfig, ConsoleConfigSchema, type DiscordConfig, DiscordConfigSchema, DiscordTransport, type FileConfig, FileConfigSchema, type GracefulShutdownOptions, type HttpErrorData, type HttpTransportBaseConfig, HttpTransportBaseConfigSchema, LOG_LEVELS, type LevelConfig, type LevelConfigObject, LevelConfigObjectSchema, LevelConfigSchema, type LevelOverride, type LevelOverrideMatch, type LevelRule, LevelRuleSchema, type LogFormat, LogFormatSchema, type LogLevel, LogLevelSchema, type LogStreamName, LogStreamNameSchema, type LogStreamPattern, type LogStreamPatternConfig, LogStreamPatternConfigSchema, LogStreamPatternSchema, type LogStreamTemplateConfig, LogStreamTemplateConfigSchema, Logger, type LoggerConfig, LoggerConfigSchema, type LoggerContext, LoggerStore, type MaskSecretsOptions, MessageBuffer, type Meta, type RelayConfig, RelayConfigSchema, type RequestIdOptions, type SerializedError, type SingletonLogger, type TelegramConfig, TelegramConfigSchema, TelegramTransport, type TimingResult, type ZohoCliqBotConfig, type ZohoCliqConfig, ZohoCliqConfigSchema, ZohoCliqTransport, assertLogLevel, createMasker, createSingletonLogger, extractRequestId, flattenObject, formatCallerInfo, formatLogfmt, formatLogfmtValue, generateRequestId, getCallerInfo, getOrGenerateRequestId, isValidLogLevel, maskSecrets, matchesContext, measureAsync, measureSync, registerShutdown, safeValidateConfig, serializeError, validateConfig };
545
+ export { AutoShutdownConfig, AutoShutdownConfigSchema, BaseHttpTransport, type BaseHttpTransportOptions, type BufferOptions, type BufferedMessage, CallerConfig, CallerConfigSchema, CallerInfo, CloudWatchConfig, CloudWatchConfigSchema, CloudWatchTransport, ConsoleConfig, ConsoleConfigSchema, DiscordConfig, DiscordConfigSchema, DiscordTransport, FileConfig, FileConfigSchema, type GracefulShutdownOptions, type HttpErrorData, HttpTransportBaseConfig, HttpTransportBaseConfigSchema, LevelConfig, LevelConfigObject, LevelConfigObjectSchema, LevelConfigSchema, LevelOverride, LevelOverrideMatch, LevelRule, LevelRuleSchema, LogFormat, LogFormatSchema, LogLevel, LogLevelSchema, LogStreamName, LogStreamNameSchema, LogStreamPattern, LogStreamPatternConfig, LogStreamPatternConfigSchema, LogStreamPatternSchema, LogStreamTemplateConfig, LogStreamTemplateConfigSchema, Logger, LoggerConfig, LoggerConfigSchema, LoggerContext, LoggerStore, MaskReplacer, MessageBuffer, Meta, RelayConfig, RelayConfigSchema, type RequestIdOptions, type SerializedError, type SingletonLogger, TelegramConfig, TelegramConfigSchema, TelegramTransport, type TimingResult, ZohoCliqConfig, ZohoCliqConfigSchema, ZohoCliqTransport, createSingletonLogger, extractRequestId, flattenObject, formatCallerInfo, formatLogfmt, formatLogfmtValue, generateRequestId, getCallerInfo, getOrGenerateRequestId, matchesContext, measureAsync, measureSync, registerShutdown, safeValidateConfig, serializeError, validateConfig };