@rawnodes/logger 2.7.1 → 2.8.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 +55 -1
- package/dist/index.d.mts +319 -8
- package/dist/index.d.ts +319 -8
- package/dist/index.js +405 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +403 -70
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
|
|
4
3
|
declare const LOG_LEVELS: {
|
|
@@ -45,6 +44,47 @@ interface HttpTransportBaseConfig {
|
|
|
45
44
|
flushInterval?: number;
|
|
46
45
|
maxRetries?: number;
|
|
47
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;
|
|
48
88
|
}
|
|
49
89
|
interface DiscordConfig extends HttpTransportBaseConfig {
|
|
50
90
|
webhookUrl: string;
|
|
@@ -64,6 +104,35 @@ interface TelegramConfig extends HttpTransportBaseConfig {
|
|
|
64
104
|
threadId?: number;
|
|
65
105
|
replyToMessageId?: number;
|
|
66
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
|
+
}
|
|
67
136
|
type LogStreamPattern = 'hostname' | 'hostname-date' | 'hostname-uuid' | 'date' | 'uuid';
|
|
68
137
|
interface LogStreamPatternConfig {
|
|
69
138
|
pattern: LogStreamPattern;
|
|
@@ -73,6 +142,20 @@ interface LogStreamTemplateConfig {
|
|
|
73
142
|
template: string;
|
|
74
143
|
}
|
|
75
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
|
+
}
|
|
76
159
|
interface CloudWatchConfig extends HttpTransportBaseConfig {
|
|
77
160
|
logGroupName: string;
|
|
78
161
|
/** Log stream name - string, pattern config, or template config. Defaults to hostname pattern */
|
|
@@ -113,6 +196,9 @@ interface LoggerConfig {
|
|
|
113
196
|
discord?: DiscordConfig | DiscordConfig[];
|
|
114
197
|
telegram?: TelegramConfig | TelegramConfig[];
|
|
115
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;
|
|
116
202
|
/** Enable caller info (file:line) in logs. Pass true for defaults or CallerConfig for options */
|
|
117
203
|
caller?: boolean | CallerConfig;
|
|
118
204
|
/** Hostname to include in all log entries. Defaults to os.hostname() if not specified */
|
|
@@ -140,7 +226,7 @@ declare class LoggerStore<TContext extends LoggerContext = LoggerContext> {
|
|
|
140
226
|
declare class Logger<TContext extends LoggerContext = LoggerContext> {
|
|
141
227
|
private state;
|
|
142
228
|
private context;
|
|
143
|
-
private profileTimers
|
|
229
|
+
private profileTimers?;
|
|
144
230
|
private constructor();
|
|
145
231
|
static create<TContext extends LoggerContext = LoggerContext>(config: LoggerConfig, store?: LoggerStore<TContext>): Logger<TContext>;
|
|
146
232
|
for(context: string): Logger<TContext>;
|
|
@@ -152,10 +238,29 @@ declare class Logger<TContext extends LoggerContext = LoggerContext> {
|
|
|
152
238
|
/**
|
|
153
239
|
* Gracefully shutdown the logger, flushing all pending messages.
|
|
154
240
|
* Should be called before process exit to ensure no logs are lost.
|
|
241
|
+
*
|
|
242
|
+
* `timeoutMs` is forwarded to each transport's `close()` as a per-transport
|
|
243
|
+
* cap; it prevents a dead transport from blocking the whole shutdown.
|
|
244
|
+
* Default: 5000ms. Pass `Infinity` for legacy unbounded behaviour.
|
|
155
245
|
*/
|
|
156
|
-
shutdown(): Promise<void>;
|
|
246
|
+
shutdown(timeoutMs?: number): Promise<void>;
|
|
157
247
|
profile(id: string, meta?: object): void;
|
|
158
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Log an error. Supported shapes:
|
|
250
|
+
* error(message: string)
|
|
251
|
+
* error(message: string, meta)
|
|
252
|
+
* error(error: Error | unknown)
|
|
253
|
+
* error(error: Error | unknown, message: string)
|
|
254
|
+
* error(error: Error | unknown, meta)
|
|
255
|
+
* error(error: Error | unknown, message: string, meta)
|
|
256
|
+
*
|
|
257
|
+
* The first argument is treated as an error value whenever it is not a string.
|
|
258
|
+
* Non-Error values (plain objects, numbers, etc. — e.g. anything caught by
|
|
259
|
+
* TypeScript's `catch (err)` clause, which is typed as `unknown`) are passed
|
|
260
|
+
* through `serializeError` so they produce a sensible `errorMessage` and, when
|
|
261
|
+
* possible, a `stack` / HTTP diagnostic payload.
|
|
262
|
+
*/
|
|
263
|
+
error(errorOrMessage: Error | string | unknown, messageOrMeta?: string | Meta, meta?: Meta): void;
|
|
159
264
|
warn(message: string, meta?: Meta): void;
|
|
160
265
|
info(message: string, meta?: Meta): void;
|
|
161
266
|
http(message: string, meta?: Meta): void;
|
|
@@ -185,6 +290,7 @@ interface BufferedMessage {
|
|
|
185
290
|
context?: string;
|
|
186
291
|
meta?: Record<string, unknown>;
|
|
187
292
|
}
|
|
293
|
+
type DropPolicy = 'drop-oldest' | 'drop-newest';
|
|
188
294
|
interface BufferOptions {
|
|
189
295
|
batchSize: number;
|
|
190
296
|
flushInterval: number;
|
|
@@ -192,6 +298,25 @@ interface BufferOptions {
|
|
|
192
298
|
retryDelay: number;
|
|
193
299
|
onFlush: (messages: BufferedMessage[]) => Promise<void>;
|
|
194
300
|
onError?: (error: Error, messages: BufferedMessage[]) => void;
|
|
301
|
+
/**
|
|
302
|
+
* Maximum number of messages the queue will hold before dropping. When the
|
|
303
|
+
* queue is full, behaviour follows `dropPolicy`. Default: unbounded.
|
|
304
|
+
*/
|
|
305
|
+
maxQueueSize?: number;
|
|
306
|
+
/**
|
|
307
|
+
* Policy applied when the queue is at `maxQueueSize` and a new message
|
|
308
|
+
* arrives. Default: `'drop-oldest'` — prefers keeping recent events, since
|
|
309
|
+
* during an outage the old ones are usually stale anyway.
|
|
310
|
+
*/
|
|
311
|
+
dropPolicy?: DropPolicy;
|
|
312
|
+
/**
|
|
313
|
+
* Called when messages are dropped due to queue overflow. Receives the
|
|
314
|
+
* messages that were discarded (not the remaining queue). If not provided,
|
|
315
|
+
* the drop is silent — consumers can still track it via buffer metrics.
|
|
316
|
+
*
|
|
317
|
+
* Callback MUST NOT throw; if it does, the exception is swallowed.
|
|
318
|
+
*/
|
|
319
|
+
onDrop?: (droppedMessages: BufferedMessage[]) => void;
|
|
195
320
|
}
|
|
196
321
|
declare class MessageBuffer {
|
|
197
322
|
private options;
|
|
@@ -199,10 +324,24 @@ declare class MessageBuffer {
|
|
|
199
324
|
private timer;
|
|
200
325
|
private flushing;
|
|
201
326
|
private closed;
|
|
327
|
+
private droppedCount;
|
|
202
328
|
constructor(options: BufferOptions);
|
|
203
329
|
add(message: BufferedMessage): void;
|
|
204
330
|
flush(): Promise<void>;
|
|
205
|
-
|
|
331
|
+
/**
|
|
332
|
+
* Stops accepting new messages and attempts to flush what's already buffered.
|
|
333
|
+
* Returns when the queue is drained OR when `timeoutMs` elapses. A timeout
|
|
334
|
+
* is essential during graceful shutdown — without it, a dead transport would
|
|
335
|
+
* block process exit indefinitely, and orchestrators like Kubernetes would
|
|
336
|
+
* escalate to SIGKILL after their grace period.
|
|
337
|
+
*
|
|
338
|
+
* Default timeout: 5 seconds. Pass `Infinity` to preserve legacy behaviour.
|
|
339
|
+
*/
|
|
340
|
+
close(timeoutMs?: number): Promise<void>;
|
|
341
|
+
/** Current number of messages waiting in the queue. */
|
|
342
|
+
get size(): number;
|
|
343
|
+
/** Total number of messages dropped due to queue overflow since creation. */
|
|
344
|
+
get droppedTotal(): number;
|
|
206
345
|
private scheduleFlush;
|
|
207
346
|
private clearTimer;
|
|
208
347
|
private sendWithRetry;
|
|
@@ -214,12 +353,35 @@ interface BaseHttpTransportOptions {
|
|
|
214
353
|
flushInterval?: number;
|
|
215
354
|
maxRetries?: number;
|
|
216
355
|
retryDelay?: number;
|
|
356
|
+
maxQueueSize?: number;
|
|
357
|
+
dropPolicy?: DropPolicy;
|
|
358
|
+
onDrop?: (droppedMessages: BufferedMessage[]) => void;
|
|
359
|
+
/**
|
|
360
|
+
* Called when a batch fails after all retries and messages are dropped.
|
|
361
|
+
* If not provided, the error is logged to stderr.
|
|
362
|
+
*
|
|
363
|
+
* The callback MUST NOT throw; if it does, the failure is swallowed and a
|
|
364
|
+
* stderr fallback is used. A logger must never propagate transport errors
|
|
365
|
+
* back into the host application.
|
|
366
|
+
*/
|
|
367
|
+
onError?: (error: Error, droppedMessages: BufferedMessage[]) => void;
|
|
217
368
|
}
|
|
218
|
-
declare abstract class BaseHttpTransport
|
|
369
|
+
declare abstract class BaseHttpTransport {
|
|
219
370
|
protected buffer: MessageBuffer;
|
|
371
|
+
private onErrorCallback?;
|
|
220
372
|
constructor(opts?: BaseHttpTransportOptions);
|
|
221
373
|
log(info: Record<string, unknown>, callback: () => void): void;
|
|
222
|
-
|
|
374
|
+
/**
|
|
375
|
+
* Stop accepting new messages and flush what's buffered. `timeoutMs` caps
|
|
376
|
+
* how long the flush may take; after that the remaining queue is discarded
|
|
377
|
+
* so shutdown can complete. Default 5000ms.
|
|
378
|
+
*/
|
|
379
|
+
close(timeoutMs?: number): Promise<void>;
|
|
380
|
+
/** Current buffered message count and total drops since creation. */
|
|
381
|
+
getMetrics(): {
|
|
382
|
+
queueSize: number;
|
|
383
|
+
droppedTotal: number;
|
|
384
|
+
};
|
|
223
385
|
protected transformMessage(info: Record<string, unknown>): BufferedMessage;
|
|
224
386
|
protected handleError(error: Error, messages: BufferedMessage[]): void;
|
|
225
387
|
protected abstract sendBatch(messages: BufferedMessage[]): Promise<void>;
|
|
@@ -231,6 +393,7 @@ declare function matchesContext(storeContext: LoggerContext | undefined, loggerC
|
|
|
231
393
|
|
|
232
394
|
declare class DiscordTransport extends BaseHttpTransport {
|
|
233
395
|
private config;
|
|
396
|
+
private requestTimeout;
|
|
234
397
|
constructor(config: DiscordConfig);
|
|
235
398
|
protected sendBatch(messages: BufferedMessage[]): Promise<void>;
|
|
236
399
|
private sendEmbedBatch;
|
|
@@ -246,6 +409,7 @@ declare class DiscordTransport extends BaseHttpTransport {
|
|
|
246
409
|
declare class TelegramTransport extends BaseHttpTransport {
|
|
247
410
|
private config;
|
|
248
411
|
private apiUrl;
|
|
412
|
+
private requestTimeout;
|
|
249
413
|
constructor(config: TelegramConfig);
|
|
250
414
|
protected sendBatch(messages: BufferedMessage[]): Promise<void>;
|
|
251
415
|
private formatBatchMessage;
|
|
@@ -275,6 +439,18 @@ declare class CloudWatchTransport extends BaseHttpTransport {
|
|
|
275
439
|
private isInvalidSequenceTokenError;
|
|
276
440
|
}
|
|
277
441
|
|
|
442
|
+
declare class ZohoCliqTransport extends BaseHttpTransport {
|
|
443
|
+
private config;
|
|
444
|
+
private endpoint;
|
|
445
|
+
private requestTimeout;
|
|
446
|
+
constructor(config: ZohoCliqConfig);
|
|
447
|
+
private buildEndpoint;
|
|
448
|
+
protected sendBatch(messages: BufferedMessage[]): Promise<void>;
|
|
449
|
+
private formatMessage;
|
|
450
|
+
private splitContent;
|
|
451
|
+
private post;
|
|
452
|
+
}
|
|
453
|
+
|
|
278
454
|
interface TimingResult {
|
|
279
455
|
label: string;
|
|
280
456
|
durationMs: number;
|
|
@@ -401,6 +577,35 @@ declare const LogStreamPatternConfigSchema: z.ZodType<LogStreamPatternConfig>;
|
|
|
401
577
|
declare const LogStreamTemplateConfigSchema: z.ZodType<LogStreamTemplateConfig>;
|
|
402
578
|
declare const LogStreamNameSchema: z.ZodType<LogStreamName>;
|
|
403
579
|
declare const CloudWatchConfigSchema: z.ZodType<CloudWatchConfig>;
|
|
580
|
+
declare const ZohoCliqConfigSchema: z.ZodObject<{
|
|
581
|
+
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
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
583
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
584
|
+
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
585
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
586
|
+
retryDelay: z.ZodOptional<z.ZodNumber>;
|
|
587
|
+
onError: z.ZodType<HttpTransportBaseConfig["onError"]>;
|
|
588
|
+
onDrop: z.ZodType<HttpTransportBaseConfig["onDrop"]>;
|
|
589
|
+
maxQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
590
|
+
dropPolicy: z.ZodOptional<z.ZodEnum<{
|
|
591
|
+
"drop-oldest": "drop-oldest";
|
|
592
|
+
"drop-newest": "drop-newest";
|
|
593
|
+
}>>;
|
|
594
|
+
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
595
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
596
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
597
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
598
|
+
region: z.ZodOptional<z.ZodString>;
|
|
599
|
+
apiKey: z.ZodString;
|
|
600
|
+
broadcast: z.ZodOptional<z.ZodBoolean>;
|
|
601
|
+
bot: z.ZodOptional<z.ZodObject<{
|
|
602
|
+
name: z.ZodString;
|
|
603
|
+
image: z.ZodOptional<z.ZodString>;
|
|
604
|
+
}, z.core.$strip>>;
|
|
605
|
+
includeTimestamp: z.ZodOptional<z.ZodBoolean>;
|
|
606
|
+
includeMeta: z.ZodOptional<z.ZodBoolean>;
|
|
607
|
+
}, z.core.$strip>;
|
|
608
|
+
declare const RelayConfigSchema: z.ZodType<RelayConfig>;
|
|
404
609
|
declare const LevelConfigObjectSchema: z.ZodType<LevelConfigObject>;
|
|
405
610
|
declare const LevelConfigSchema: z.ZodType<LevelConfig>;
|
|
406
611
|
declare const CallerConfigSchema: z.ZodType<CallerConfig>;
|
|
@@ -412,6 +617,62 @@ declare const LoggerConfigSchema: z.ZodObject<{
|
|
|
412
617
|
discord: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<DiscordConfig, unknown, z.core.$ZodTypeInternals<DiscordConfig, unknown>>, z.ZodArray<z.ZodType<DiscordConfig, unknown, z.core.$ZodTypeInternals<DiscordConfig, unknown>>>]>>;
|
|
413
618
|
telegram: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<TelegramConfig, unknown, z.core.$ZodTypeInternals<TelegramConfig, unknown>>, z.ZodArray<z.ZodType<TelegramConfig, unknown, z.core.$ZodTypeInternals<TelegramConfig, unknown>>>]>>;
|
|
414
619
|
cloudwatch: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<CloudWatchConfig, unknown, z.core.$ZodTypeInternals<CloudWatchConfig, unknown>>, z.ZodArray<z.ZodType<CloudWatchConfig, unknown, z.core.$ZodTypeInternals<CloudWatchConfig, unknown>>>]>>;
|
|
620
|
+
zohoCliq: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
621
|
+
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
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
623
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
624
|
+
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
625
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
626
|
+
retryDelay: z.ZodOptional<z.ZodNumber>;
|
|
627
|
+
onError: z.ZodType<HttpTransportBaseConfig["onError"]>;
|
|
628
|
+
onDrop: z.ZodType<HttpTransportBaseConfig["onDrop"]>;
|
|
629
|
+
maxQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
630
|
+
dropPolicy: z.ZodOptional<z.ZodEnum<{
|
|
631
|
+
"drop-oldest": "drop-oldest";
|
|
632
|
+
"drop-newest": "drop-newest";
|
|
633
|
+
}>>;
|
|
634
|
+
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
635
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
636
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
637
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
638
|
+
region: z.ZodOptional<z.ZodString>;
|
|
639
|
+
apiKey: z.ZodString;
|
|
640
|
+
broadcast: z.ZodOptional<z.ZodBoolean>;
|
|
641
|
+
bot: z.ZodOptional<z.ZodObject<{
|
|
642
|
+
name: z.ZodString;
|
|
643
|
+
image: z.ZodOptional<z.ZodString>;
|
|
644
|
+
}, z.core.$strip>>;
|
|
645
|
+
includeTimestamp: z.ZodOptional<z.ZodBoolean>;
|
|
646
|
+
includeMeta: z.ZodOptional<z.ZodBoolean>;
|
|
647
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
648
|
+
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
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
650
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
651
|
+
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
652
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
653
|
+
retryDelay: z.ZodOptional<z.ZodNumber>;
|
|
654
|
+
onError: z.ZodType<HttpTransportBaseConfig["onError"]>;
|
|
655
|
+
onDrop: z.ZodType<HttpTransportBaseConfig["onDrop"]>;
|
|
656
|
+
maxQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
657
|
+
dropPolicy: z.ZodOptional<z.ZodEnum<{
|
|
658
|
+
"drop-oldest": "drop-oldest";
|
|
659
|
+
"drop-newest": "drop-newest";
|
|
660
|
+
}>>;
|
|
661
|
+
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
662
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
663
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
664
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
665
|
+
region: z.ZodOptional<z.ZodString>;
|
|
666
|
+
apiKey: z.ZodString;
|
|
667
|
+
broadcast: z.ZodOptional<z.ZodBoolean>;
|
|
668
|
+
bot: z.ZodOptional<z.ZodObject<{
|
|
669
|
+
name: z.ZodString;
|
|
670
|
+
image: z.ZodOptional<z.ZodString>;
|
|
671
|
+
}, z.core.$strip>>;
|
|
672
|
+
includeTimestamp: z.ZodOptional<z.ZodBoolean>;
|
|
673
|
+
includeMeta: z.ZodOptional<z.ZodBoolean>;
|
|
674
|
+
}, z.core.$strip>>]>>;
|
|
675
|
+
relay: z.ZodOptional<z.ZodType<RelayConfig, unknown, z.core.$ZodTypeInternals<RelayConfig, unknown>>>;
|
|
415
676
|
caller: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodType<CallerConfig, unknown, z.core.$ZodTypeInternals<CallerConfig, unknown>>]>>;
|
|
416
677
|
hostname: z.ZodOptional<z.ZodString>;
|
|
417
678
|
autoShutdown: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodType<AutoShutdownConfig, unknown, z.core.$ZodTypeInternals<AutoShutdownConfig, unknown>>]>>;
|
|
@@ -424,9 +685,59 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
|
|
|
424
685
|
discord?: DiscordConfig | DiscordConfig[] | undefined;
|
|
425
686
|
telegram?: TelegramConfig | TelegramConfig[] | undefined;
|
|
426
687
|
cloudwatch?: CloudWatchConfig | CloudWatchConfig[] | undefined;
|
|
688
|
+
zohoCliq?: {
|
|
689
|
+
onError: ((error: Error, droppedMessages: unknown[]) => void) | undefined;
|
|
690
|
+
onDrop: ((droppedMessages: unknown[]) => void) | undefined;
|
|
691
|
+
apiKey: string;
|
|
692
|
+
level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
693
|
+
rules?: LevelRule[] | undefined;
|
|
694
|
+
batchSize?: number | undefined;
|
|
695
|
+
flushInterval?: number | undefined;
|
|
696
|
+
maxRetries?: number | undefined;
|
|
697
|
+
retryDelay?: number | undefined;
|
|
698
|
+
maxQueueSize?: number | undefined;
|
|
699
|
+
dropPolicy?: "drop-oldest" | "drop-newest" | undefined;
|
|
700
|
+
requestTimeout?: number | undefined;
|
|
701
|
+
webhookUrl?: string | undefined;
|
|
702
|
+
companyId?: string | undefined;
|
|
703
|
+
channel?: string | undefined;
|
|
704
|
+
region?: string | undefined;
|
|
705
|
+
broadcast?: boolean | undefined;
|
|
706
|
+
bot?: {
|
|
707
|
+
name: string;
|
|
708
|
+
image?: string | undefined;
|
|
709
|
+
} | undefined;
|
|
710
|
+
includeTimestamp?: boolean | undefined;
|
|
711
|
+
includeMeta?: boolean | undefined;
|
|
712
|
+
} | {
|
|
713
|
+
onError: ((error: Error, droppedMessages: unknown[]) => void) | undefined;
|
|
714
|
+
onDrop: ((droppedMessages: unknown[]) => void) | undefined;
|
|
715
|
+
apiKey: string;
|
|
716
|
+
level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
717
|
+
rules?: LevelRule[] | undefined;
|
|
718
|
+
batchSize?: number | undefined;
|
|
719
|
+
flushInterval?: number | undefined;
|
|
720
|
+
maxRetries?: number | undefined;
|
|
721
|
+
retryDelay?: number | undefined;
|
|
722
|
+
maxQueueSize?: number | undefined;
|
|
723
|
+
dropPolicy?: "drop-oldest" | "drop-newest" | undefined;
|
|
724
|
+
requestTimeout?: number | undefined;
|
|
725
|
+
webhookUrl?: string | undefined;
|
|
726
|
+
companyId?: string | undefined;
|
|
727
|
+
channel?: string | undefined;
|
|
728
|
+
region?: string | undefined;
|
|
729
|
+
broadcast?: boolean | undefined;
|
|
730
|
+
bot?: {
|
|
731
|
+
name: string;
|
|
732
|
+
image?: string | undefined;
|
|
733
|
+
} | undefined;
|
|
734
|
+
includeTimestamp?: boolean | undefined;
|
|
735
|
+
includeMeta?: boolean | undefined;
|
|
736
|
+
}[] | undefined;
|
|
737
|
+
relay?: RelayConfig | undefined;
|
|
427
738
|
caller?: boolean | CallerConfig | undefined;
|
|
428
739
|
hostname?: string | undefined;
|
|
429
740
|
autoShutdown?: boolean | AutoShutdownConfig | undefined;
|
|
430
741
|
}>;
|
|
431
742
|
|
|
432
|
-
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 RequestIdOptions, type SerializedError, type SingletonLogger, type TelegramConfig, TelegramConfigSchema, TelegramTransport, type TimingResult, assertLogLevel, createMasker, createSingletonLogger, extractRequestId, flattenObject, formatCallerInfo, formatLogfmt, formatLogfmtValue, generateRequestId, getCallerInfo, getOrGenerateRequestId, isValidLogLevel, maskSecrets, matchesContext, measureAsync, measureSync, registerShutdown, safeValidateConfig, serializeError, validateConfig };
|
|
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 };
|