voltlog-io 1.0.4 → 1.0.6

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/dist/index.js CHANGED
@@ -1,40 +1,425 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/core/types.ts
9
+ var LogLevel = {
10
+ TRACE: 10,
11
+ DEBUG: 20,
12
+ INFO: 30,
13
+ WARN: 40,
14
+ ERROR: 50,
15
+ FATAL: 60,
16
+ SILENT: Infinity
17
+ };
18
+ var LogLevelNameMap = Object.fromEntries(
19
+ Object.entries(LogLevel).map(([k, v]) => [k.toLowerCase(), v])
20
+ );
21
+ var LogLevelValueMap = Object.fromEntries(
22
+ Object.entries(LogLevel).filter(([, v]) => Number.isFinite(v)).map(([k, v]) => [v, k])
23
+ );
24
+
25
+ // src/core/levels.ts
26
+ function resolveLevel(level) {
27
+ const n = LogLevelNameMap[level.toLowerCase()];
28
+ return n !== void 0 ? n : LogLevel.INFO;
29
+ }
30
+ function shouldLog(entryLevel, filterLevel) {
31
+ return entryLevel >= filterLevel;
32
+ }
33
+ function shouldIncludeStack(entryLevel, includeStack) {
34
+ if (typeof includeStack === "boolean") return includeStack;
35
+ return entryLevel >= resolveLevel(includeStack);
36
+ }
33
37
 
38
+ // src/core/pipeline.ts
39
+ function composeMiddleware(middleware, final) {
40
+ if (middleware.length === 0) return final;
41
+ return (entry) => {
42
+ let index = 0;
43
+ const next = (e) => {
44
+ if (index < middleware.length) {
45
+ const mw = middleware[index++];
46
+ mw(e, next);
47
+ } else {
48
+ final(e);
49
+ }
50
+ };
51
+ next(entry);
52
+ };
53
+ }
54
+ function fanOutToTransports(entry, transports, loggerLevel) {
55
+ for (const t of transports) {
56
+ const tLevel = t.level ? resolveLevel(t.level) : loggerLevel;
57
+ if (!shouldLog(entry.level, tLevel)) continue;
58
+ try {
59
+ const result = t.write(entry);
60
+ if (result && typeof result.catch === "function") {
61
+ result.catch(() => {
62
+ });
63
+ }
64
+ } catch (e2) {
65
+ }
66
+ }
67
+ }
34
68
 
69
+ // src/core/logger.ts
70
+ var randomUUID = typeof _optionalChain([globalThis, 'access', _2 => _2.crypto, 'optionalAccess', _3 => _3.randomUUID]) === "function" ? () => globalThis.crypto.randomUUID() : () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
71
+ const r = Math.random() * 16 | 0;
72
+ return (c === "x" ? r : r & 3 | 8).toString(16);
73
+ });
74
+ var LoggerImpl = class {
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+ constructor(options = {}) {
84
+ this._level = resolveLevel(_nullishCoalesce(options.level, () => ( "INFO")));
85
+ this._transports = [..._nullishCoalesce(options.transports, () => ( []))];
86
+ this._middlewareList = [..._nullishCoalesce(options.middleware, () => ( []))];
87
+ this._context = options.context ? { ...options.context } : {};
88
+ this._includeStack = _nullishCoalesce(options.includeStack, () => ( "ERROR"));
89
+ this._timestampFn = _nullishCoalesce(options.timestamp, () => ( Date.now));
90
+ this._idFn = options.idGenerator !== void 0 ? options.idGenerator : randomUUID;
91
+ this._pipeline = this._buildPipeline();
92
+ }
93
+ // ─── Log Methods ────────────────────────────────────────────
94
+ trace(message, meta) {
95
+ if (10 < this._level) return;
96
+ this._log(10, "TRACE", message, meta);
97
+ }
98
+ debug(message, meta) {
99
+ if (20 < this._level) return;
100
+ this._log(20, "DEBUG", message, meta);
101
+ }
102
+ info(message, meta) {
103
+ if (30 < this._level) return;
104
+ this._log(30, "INFO", message, meta);
105
+ }
106
+ warn(message, meta) {
107
+ if (40 < this._level) return;
108
+ this._log(40, "WARN", message, meta);
109
+ }
110
+ error(message, metaOrError, error) {
111
+ if (50 < this._level) return;
112
+ if (metaOrError instanceof Error) {
113
+ this._log(50, "ERROR", message, void 0, metaOrError);
114
+ } else {
115
+ this._log(50, "ERROR", message, metaOrError, error);
116
+ }
117
+ }
118
+ fatal(message, metaOrError, error) {
119
+ if (metaOrError instanceof Error) {
120
+ this._log(60, "FATAL", message, void 0, metaOrError);
121
+ } else {
122
+ this._log(60, "FATAL", message, metaOrError, error);
123
+ }
124
+ }
125
+ // ─── Child Logger ───────────────────────────────────────────
126
+ child(context) {
127
+ return new ChildLoggerImpl(this, { ...this._context, ...context });
128
+ }
129
+ // ─── Dynamic Configuration ─────────────────────────────────
130
+ addTransport(transport) {
131
+ this._transports.push(transport);
132
+ }
133
+ removeTransport(name) {
134
+ this._transports = this._transports.filter((t) => t.name !== name);
135
+ }
136
+ addMiddleware(middleware) {
137
+ this._middlewareList.push(middleware);
138
+ this._pipeline = this._buildPipeline();
139
+ }
140
+ removeMiddleware(middleware) {
141
+ this._middlewareList = this._middlewareList.filter((m) => m !== middleware);
142
+ this._pipeline = this._buildPipeline();
143
+ }
144
+ // ─── Level Control ─────────────────────────────────────────
145
+ setLevel(level) {
146
+ this._level = resolveLevel(level);
147
+ }
148
+ getLevel() {
149
+ return _nullishCoalesce(LogLevelValueMap[this._level], () => ( "INFO"));
150
+ }
151
+ isLevelEnabled(level) {
152
+ return resolveLevel(level) >= this._level;
153
+ }
154
+ // ─── Timer ─────────────────────────────────────────────────
155
+ startTimer(level) {
156
+ const start = performance.now();
157
+ const logLevel = _nullishCoalesce(level, () => ( "INFO"));
158
+ return {
159
+ done: (message, meta) => {
160
+ const durationMs = Math.round(performance.now() - start);
161
+ const merged = { ...meta, durationMs };
162
+ const methodKey = logLevel.toLowerCase();
163
+ this[methodKey](message, merged);
164
+ },
165
+ elapsed: () => Math.round(performance.now() - start)
166
+ };
167
+ }
168
+ // ─── Lifecycle ──────────────────────────────────────────────
169
+ async flush() {
170
+ await Promise.all(this._transports.map((t) => _optionalChain([t, 'access', _4 => _4.flush, 'optionalCall', _5 => _5()])).filter(Boolean));
171
+ }
172
+ async close() {
173
+ await this.flush();
174
+ await Promise.all(this._transports.map((t) => _optionalChain([t, 'access', _6 => _6.close, 'optionalCall', _7 => _7()])).filter(Boolean));
175
+ }
176
+ // ─── Internal ───────────────────────────────────────────────
177
+ /** @internal */
178
+ _log(level, levelName, message, meta, error) {
179
+ this._logWithContext(level, levelName, message, this._context, meta, error);
180
+ }
181
+ /** @internal — used by child loggers to inject bound context */
182
+ _logWithContext(level, levelName, message, context, meta, error) {
183
+ if (!shouldLog(level, this._level)) return;
184
+ const entry = {
185
+ id: this._idFn ? this._idFn() : "",
186
+ level,
187
+ levelName,
188
+ message,
189
+ timestamp: this._timestampFn(),
190
+ meta: _nullishCoalesce(meta, () => ( {})),
191
+ context: Object.keys(context).length > 0 ? context : void 0
192
+ };
193
+ if (error) {
194
+ entry.error = serializeError(
195
+ error,
196
+ shouldIncludeStack(level, this._includeStack)
197
+ );
198
+ }
199
+ this._pipeline(entry);
200
+ }
201
+ _buildPipeline() {
202
+ return composeMiddleware(this._middlewareList, (entry) => {
203
+ fanOutToTransports(entry, this._transports, this._level);
204
+ });
205
+ }
206
+ };
207
+ function serializeError(error, includeStack, depth = 0) {
208
+ const logError = {
209
+ message: error.message,
210
+ name: error.name,
211
+ code: error.code
212
+ };
213
+ if (includeStack) {
214
+ logError.stack = error.stack;
215
+ }
216
+ if (error.cause instanceof Error && depth < 5) {
217
+ logError.cause = serializeError(error.cause, includeStack, depth + 1);
218
+ }
219
+ return logError;
220
+ }
221
+ var ChildLoggerImpl = class _ChildLoggerImpl {
222
+ constructor(_parent, _context) {
223
+ this._parent = _parent;
224
+ this._context = _context;
225
+ }
226
+ trace(message, meta) {
227
+ this._parent._logWithContext(10, "TRACE", message, this._context, meta);
228
+ }
229
+ debug(message, meta) {
230
+ this._parent._logWithContext(20, "DEBUG", message, this._context, meta);
231
+ }
232
+ info(message, meta) {
233
+ this._parent._logWithContext(30, "INFO", message, this._context, meta);
234
+ }
235
+ warn(message, meta) {
236
+ this._parent._logWithContext(40, "WARN", message, this._context, meta);
237
+ }
238
+ error(message, metaOrError, error) {
239
+ if (metaOrError instanceof Error) {
240
+ this._parent._logWithContext(
241
+ 50,
242
+ "ERROR",
243
+ message,
244
+ this._context,
245
+ void 0,
246
+ metaOrError
247
+ );
248
+ } else {
249
+ this._parent._logWithContext(
250
+ 50,
251
+ "ERROR",
252
+ message,
253
+ this._context,
254
+ metaOrError,
255
+ error
256
+ );
257
+ }
258
+ }
259
+ fatal(message, metaOrError, error) {
260
+ if (metaOrError instanceof Error) {
261
+ this._parent._logWithContext(
262
+ 60,
263
+ "FATAL",
264
+ message,
265
+ this._context,
266
+ void 0,
267
+ metaOrError
268
+ );
269
+ } else {
270
+ this._parent._logWithContext(
271
+ 60,
272
+ "FATAL",
273
+ message,
274
+ this._context,
275
+ metaOrError,
276
+ error
277
+ );
278
+ }
279
+ }
280
+ child(context) {
281
+ return new _ChildLoggerImpl(this._parent, {
282
+ ...this._context,
283
+ ...context
284
+ });
285
+ }
286
+ addTransport(transport) {
287
+ this._parent.addTransport(transport);
288
+ }
289
+ removeTransport(name) {
290
+ this._parent.removeTransport(name);
291
+ }
292
+ addMiddleware(middleware) {
293
+ this._parent.addMiddleware(middleware);
294
+ }
295
+ removeMiddleware(middleware) {
296
+ this._parent.removeMiddleware(middleware);
297
+ }
298
+ setLevel(level) {
299
+ this._parent.setLevel(level);
300
+ }
301
+ getLevel() {
302
+ return this._parent.getLevel();
303
+ }
304
+ isLevelEnabled(level) {
305
+ return this._parent.isLevelEnabled(level);
306
+ }
307
+ startTimer(level) {
308
+ return this._parent.startTimer(level);
309
+ }
310
+ flush() {
311
+ return this._parent.flush();
312
+ }
313
+ close() {
314
+ return this._parent.close();
315
+ }
316
+ };
317
+ function createLogger(options) {
318
+ return new LoggerImpl(options);
319
+ }
35
320
 
321
+ // src/middleware/ai-enrichment.ts
322
+ function aiEnrichmentMiddleware(options) {
323
+ const minLevel = resolveLevel(_nullishCoalesce(options.level, () => ( "ERROR")));
324
+ const timeoutMs = _nullishCoalesce(options.timeout, () => ( 2e3));
325
+ const swallow = _nullishCoalesce(options.swallowErrors, () => ( true));
326
+ const fieldName = _nullishCoalesce(options.targetField, () => ( "ai_analysis"));
327
+ return async (entry, next) => {
328
+ if (entry.level < minLevel) {
329
+ next(entry);
330
+ return;
331
+ }
332
+ try {
333
+ const analysisPromise = options.analyzer(entry);
334
+ const timeoutPromise = new Promise(
335
+ (_, reject) => setTimeout(() => reject(new Error("AI Analysis Timeout")), timeoutMs)
336
+ );
337
+ const result = await Promise.race([analysisPromise, timeoutPromise]);
338
+ if (result) {
339
+ entry.meta = {
340
+ ...entry.meta,
341
+ [fieldName]: result
342
+ };
343
+ }
344
+ } catch (err) {
345
+ if (!swallow) {
346
+ throw err;
347
+ }
348
+ }
349
+ next(entry);
350
+ };
351
+ }
352
+ function createOpenAiErrorAnalyzer(apiKey, model = "gpt-3.5-turbo", systemPrompt = "You are a log analyzer. Explain this error briefly and suggest a fix in 1 sentence.") {
353
+ return async (entry) => {
354
+ try {
355
+ const response = await fetch(
356
+ "https://api.openai.com/v1/chat/completions",
357
+ {
358
+ method: "POST",
359
+ headers: {
360
+ "Content-Type": "application/json",
361
+ Authorization: `Bearer ${apiKey}`
362
+ },
363
+ body: JSON.stringify({
364
+ model,
365
+ messages: [
366
+ { role: "system", content: systemPrompt },
367
+ {
368
+ role: "user",
369
+ content: `Error Message: ${entry.message}
370
+ Context: ${JSON.stringify(entry.meta)}`
371
+ }
372
+ ],
373
+ max_tokens: 150
374
+ })
375
+ }
376
+ );
377
+ if (!response.ok) return null;
378
+ const data = await response.json();
379
+ return _nullishCoalesce(_optionalChain([data, 'access', _8 => _8.choices, 'optionalAccess', _9 => _9[0], 'optionalAccess', _10 => _10.message, 'optionalAccess', _11 => _11.content]), () => ( null));
380
+ } catch (e3) {
381
+ return null;
382
+ }
383
+ };
384
+ }
36
385
 
37
- var _chunk4WQ4K5BMjs = require('./chunk-4WQ4K5BM.js');
386
+ // src/middleware/alert.ts
387
+ function alertMiddleware(rules) {
388
+ const states = /* @__PURE__ */ new Map();
389
+ for (const rule of rules) {
390
+ states.set(rule.name, { entries: [], lastFired: -Infinity });
391
+ }
392
+ return (entry, next) => {
393
+ const now = entry.timestamp;
394
+ for (const rule of rules) {
395
+ if (!rule.when(entry)) continue;
396
+ const state = states.get(rule.name);
397
+ const windowMs = _nullishCoalesce(rule.windowMs, () => ( Infinity));
398
+ const threshold = _nullishCoalesce(rule.threshold, () => ( 1));
399
+ const cooldownMs = _nullishCoalesce(rule.cooldownMs, () => ( 0));
400
+ if (Number.isFinite(windowMs)) {
401
+ state.entries = state.entries.filter(
402
+ (e) => now - e.timestamp < windowMs
403
+ );
404
+ }
405
+ state.entries.push(entry);
406
+ if (state.entries.length >= threshold && now - state.lastFired >= cooldownMs) {
407
+ const alertEntries = [...state.entries];
408
+ state.entries = [];
409
+ state.lastFired = now;
410
+ try {
411
+ const result = rule.onAlert(alertEntries);
412
+ if (result && typeof result.catch === "function") {
413
+ result.catch(() => {
414
+ });
415
+ }
416
+ } catch (e4) {
417
+ }
418
+ }
419
+ }
420
+ next(entry);
421
+ };
422
+ }
38
423
 
39
424
  // src/middleware/async-context.ts
40
425
  var _async_hooks = require('async_hooks');
@@ -96,6 +481,583 @@ function correlationIdMiddleware(options = {}) {
96
481
  };
97
482
  }
98
483
 
484
+ // src/middleware/create-middleware.ts
485
+ function createMiddleware(fn) {
486
+ return fn;
487
+ }
488
+
489
+ // src/middleware/deduplication.ts
490
+ function deduplicationMiddleware(options = {}) {
491
+ const windowMs = _nullishCoalesce(options.windowMs, () => ( 1e3));
492
+ const keyFn = _nullishCoalesce(options.keyFn, () => ( ((e) => `${e.level}:${e.message}:${_nullishCoalesce(_optionalChain([e, 'access', _12 => _12.error, 'optionalAccess', _13 => _13.message]), () => ( ""))}`)));
493
+ const buffer = /* @__PURE__ */ new Map();
494
+ return (entry, next) => {
495
+ const key = keyFn(entry);
496
+ if (buffer.has(key)) {
497
+ const state = buffer.get(key);
498
+ state.count++;
499
+ return;
500
+ }
501
+ const timer = setTimeout(() => {
502
+ const state = buffer.get(key);
503
+ if (state) {
504
+ buffer.delete(key);
505
+ if (state.count > 1) {
506
+ state.entry.meta = {
507
+ ...state.entry.meta,
508
+ duplicateCount: state.count
509
+ };
510
+ }
511
+ next(state.entry);
512
+ }
513
+ }, windowMs);
514
+ buffer.set(key, {
515
+ entry,
516
+ count: 1,
517
+ timer
518
+ });
519
+ };
520
+ }
521
+
522
+ // src/middleware/heap-usage.ts
523
+ function heapUsageMiddleware(options = {}) {
524
+ const fieldName = _nullishCoalesce(options.fieldName, () => ( "memory"));
525
+ return (entry, next) => {
526
+ if (typeof process !== "undefined" && process.memoryUsage) {
527
+ const memory = process.memoryUsage();
528
+ entry.meta = {
529
+ ...entry.meta,
530
+ [fieldName]: {
531
+ rss: memory.rss,
532
+ heapTotal: memory.heapTotal,
533
+ heapUsed: memory.heapUsed
534
+ }
535
+ };
536
+ }
537
+ next(entry);
538
+ };
539
+ }
540
+
541
+ // src/middleware/http.ts
542
+ var nodeHttpMappers = {
543
+ req: {
544
+ getMethod: (req) => req.method || "UNKNOWN",
545
+ getUrl: (req) => req.originalUrl || req.url || "/",
546
+ getIp: (req) => req.ip || _optionalChain([req, 'access', _14 => _14.socket, 'optionalAccess', _15 => _15.remoteAddress]) || _optionalChain([req, 'access', _16 => _16.headers, 'optionalAccess', _17 => _17["x-forwarded-for"]]) || void 0,
547
+ getUserAgent: (req) => _optionalChain([req, 'access', _18 => _18.headers, 'optionalAccess', _19 => _19["user-agent"]]) || void 0,
548
+ getHeader: (req, name) => _optionalChain([req, 'access', _20 => _20.headers, 'optionalAccess', _21 => _21[name]]) || void 0
549
+ },
550
+ res: {
551
+ getStatusCode: (res) => res.statusCode || 200,
552
+ onFinish: (res, callback) => {
553
+ if (typeof res.on === "function") {
554
+ res.on("finish", callback);
555
+ res.on("close", callback);
556
+ } else {
557
+ callback();
558
+ }
559
+ }
560
+ }
561
+ };
562
+ function createHttpLogger(logger, options) {
563
+ const {
564
+ reqMapper,
565
+ resMapper,
566
+ level = "INFO",
567
+ skip,
568
+ extractContext
569
+ } = options;
570
+ return (req, res) => {
571
+ if (_optionalChain([skip, 'optionalCall', _22 => _22(req)])) {
572
+ return;
573
+ }
574
+ const startTime = performance.now();
575
+ let finished = false;
576
+ resMapper.onFinish(res, () => {
577
+ if (finished) return;
578
+ finished = true;
579
+ const durationMs = Math.round(performance.now() - startTime);
580
+ const statusCode = resMapper.getStatusCode(res);
581
+ const method = reqMapper.getMethod(req);
582
+ const url = reqMapper.getUrl(req);
583
+ const meta = {
584
+ method,
585
+ url,
586
+ statusCode,
587
+ durationMs,
588
+ ip: reqMapper.getIp ? reqMapper.getIp(req) : void 0,
589
+ userAgent: reqMapper.getUserAgent ? reqMapper.getUserAgent(req) : void 0
590
+ };
591
+ if (extractContext) {
592
+ Object.assign(meta, extractContext(req, res));
593
+ }
594
+ let finalLevel = level;
595
+ if (statusCode >= 500) finalLevel = "ERROR";
596
+ else if (statusCode >= 400 && level === "INFO") finalLevel = "WARN";
597
+ const methodKey = finalLevel.toLowerCase();
598
+ logger[methodKey](
599
+ `${method} ${url} - ${statusCode} (${durationMs}ms)`,
600
+ meta
601
+ );
602
+ });
603
+ };
604
+ }
605
+
606
+ // src/middleware/ip.ts
607
+ function ipMiddleware(options = {}) {
608
+ const targetField = _nullishCoalesce(options.fieldName, () => ( "ip"));
609
+ const keysToCheck = _nullishCoalesce(options.headerKeys, () => ( [
610
+ "x-forwarded-for",
611
+ "x-real-ip",
612
+ "req.ip",
613
+ "ip",
614
+ "x-client-ip"
615
+ ]));
616
+ return (entry, next) => {
617
+ const meta = entry.meta;
618
+ const headers = meta.headers || {};
619
+ const req = meta.req || {};
620
+ let foundIp;
621
+ for (const key of keysToCheck) {
622
+ if (typeof meta[key] === "string") {
623
+ foundIp = meta[key];
624
+ break;
625
+ }
626
+ if (typeof headers[key] === "string") {
627
+ foundIp = headers[key];
628
+ break;
629
+ }
630
+ if (typeof req[key] === "string") {
631
+ foundIp = req[key];
632
+ break;
633
+ }
634
+ if (key === "req.ip" && typeof req.ip === "string") {
635
+ foundIp = req.ip;
636
+ break;
637
+ }
638
+ }
639
+ if (foundIp) {
640
+ const firstIp = typeof foundIp === "string" ? foundIp.split(",")[0].trim() : String(foundIp);
641
+ entry.meta = {
642
+ ...entry.meta,
643
+ [targetField]: firstIp
644
+ };
645
+ }
646
+ next(entry);
647
+ };
648
+ }
649
+
650
+ // src/middleware/level-override.ts
651
+ function levelOverrideMiddleware(options = {}) {
652
+ const key = _nullishCoalesce(options.key, () => ( "x-log-level"));
653
+ const cleanup = _nullishCoalesce(options.cleanup, () => ( true));
654
+ return (entry, next) => {
655
+ const meta = entry.meta;
656
+ const context = entry.context;
657
+ const levelName = meta[key] || _optionalChain([context, 'optionalAccess', _23 => _23[key]]) || _optionalChain([meta, 'access', _24 => _24.headers, 'optionalAccess', _25 => _25[key]]);
658
+ if (levelName && typeof levelName === "string") {
659
+ const upperName = levelName.toUpperCase();
660
+ if (LogLevel[upperName]) {
661
+ entry.level = LogLevel[upperName];
662
+ entry.levelName = upperName;
663
+ if (cleanup) {
664
+ delete meta[key];
665
+ if (meta.headers) {
666
+ delete meta.headers[key];
667
+ }
668
+ }
669
+ }
670
+ }
671
+ next(entry);
672
+ };
673
+ }
674
+
675
+ // src/middleware/ocpp.ts
676
+ function ocppMiddleware(options = {}) {
677
+ const autoPayloadSize = _nullishCoalesce(options.autoPayloadSize, () => ( true));
678
+ const propagateCorrelationId = _nullishCoalesce(options.propagateCorrelationId, () => ( true));
679
+ return (entry, next) => {
680
+ const enriched = { ...entry, meta: { ...entry.meta } };
681
+ if (autoPayloadSize && enriched.meta.payloadSize === void 0 && enriched.meta.action) {
682
+ try {
683
+ enriched.meta.payloadSize = JSON.stringify(enriched.meta).length;
684
+ } catch (e5) {
685
+ }
686
+ }
687
+ if (propagateCorrelationId && enriched.meta.correlationId && !enriched.correlationId) {
688
+ enriched.correlationId = enriched.meta.correlationId;
689
+ }
690
+ next(enriched);
691
+ };
692
+ }
693
+
694
+ // src/middleware/otel-trace.ts
695
+ function otelTraceMiddleware(options = {}) {
696
+ let traceApi = _nullishCoalesce(options.traceApi, () => ( null));
697
+ let resolved = !!traceApi;
698
+ if (!resolved) {
699
+ try {
700
+ const { createRequire } = __require("module");
701
+ const dynamicRequire = createRequire(__filename);
702
+ const api = dynamicRequire("@opentelemetry/api");
703
+ traceApi = api;
704
+ resolved = true;
705
+ } catch (e6) {
706
+ }
707
+ }
708
+ return (entry, next) => {
709
+ if (resolved && _optionalChain([traceApi, 'optionalAccess', _26 => _26.trace])) {
710
+ try {
711
+ const activeSpan = _optionalChain([traceApi, 'access', _27 => _27.trace, 'access', _28 => _28.getActiveSpan, 'optionalCall', _29 => _29()]);
712
+ if (activeSpan) {
713
+ const spanContext = _optionalChain([activeSpan, 'access', _30 => _30.spanContext, 'optionalCall', _31 => _31()]);
714
+ if (spanContext) {
715
+ const meta = entry.meta;
716
+ meta.traceId = spanContext.traceId;
717
+ meta.spanId = spanContext.spanId;
718
+ meta.traceFlags = spanContext.traceFlags;
719
+ if (!entry.correlationId) {
720
+ entry.correlationId = spanContext.traceId;
721
+ }
722
+ }
723
+ }
724
+ } catch (e7) {
725
+ }
726
+ }
727
+ next(entry);
728
+ };
729
+ }
730
+
731
+ // src/middleware/redaction.ts
732
+ var DEFAULT_REDACT_VALUE = "[REDACTED]";
733
+ function redactionMiddleware(options) {
734
+ const paths = new Set(options.paths.map((p) => p.toLowerCase()));
735
+ const replacement = _nullishCoalesce(options.replacement, () => ( DEFAULT_REDACT_VALUE));
736
+ const deep = _nullishCoalesce(options.deep, () => ( true));
737
+ function redactObject(obj) {
738
+ const result = {};
739
+ for (const [key, value] of Object.entries(obj)) {
740
+ if (paths.has(key.toLowerCase())) {
741
+ result[key] = replacement;
742
+ } else if (deep && value !== null && typeof value === "object" && !Array.isArray(value)) {
743
+ result[key] = redactObject(value);
744
+ } else {
745
+ result[key] = value;
746
+ }
747
+ }
748
+ return result;
749
+ }
750
+ return (entry, next) => {
751
+ const redacted = { ...entry };
752
+ if (entry.meta && typeof entry.meta === "object") {
753
+ redacted.meta = redactObject(
754
+ entry.meta
755
+ );
756
+ }
757
+ if (entry.context && typeof entry.context === "object") {
758
+ redacted.context = redactObject(entry.context);
759
+ }
760
+ next(redacted);
761
+ };
762
+ }
763
+
764
+ // src/middleware/sampling.ts
765
+ function samplingMiddleware(options = {}) {
766
+ const keyFn = _nullishCoalesce(options.keyFn, () => ( ((entry) => entry.message)));
767
+ const maxPerWindow = _nullishCoalesce(options.maxPerWindow, () => ( 100));
768
+ const windowMs = _nullishCoalesce(options.windowMs, () => ( 6e4));
769
+ const sampleRate = _nullishCoalesce(options.sampleRate, () => ( 1));
770
+ const priorityLevel = _nullishCoalesce(options.priorityLevel, () => ( 40));
771
+ const buckets = /* @__PURE__ */ new Map();
772
+ return (entry, next) => {
773
+ if (entry.level >= priorityLevel) {
774
+ return next(entry);
775
+ }
776
+ if (sampleRate < 1 && Math.random() > sampleRate) {
777
+ return;
778
+ }
779
+ const key = keyFn(entry);
780
+ const now = entry.timestamp;
781
+ let bucket = buckets.get(key);
782
+ if (!bucket || now - bucket.windowStart >= windowMs) {
783
+ bucket = { count: 0, windowStart: now };
784
+ buckets.set(key, bucket);
785
+ }
786
+ if (bucket.count < maxPerWindow) {
787
+ bucket.count++;
788
+ next(entry);
789
+ }
790
+ if (buckets.size > 2e3) {
791
+ const expireBefore = now - windowMs * 2;
792
+ for (const [k, b] of buckets) {
793
+ if (b.windowStart < expireBefore) {
794
+ buckets.delete(k);
795
+ }
796
+ }
797
+ }
798
+ };
799
+ }
800
+
801
+ // src/middleware/user-agent.ts
802
+ function userAgentMiddleware(options = {}) {
803
+ const sourceField = options.sourceField;
804
+ const targetField = _nullishCoalesce(options.targetField, () => ( "client"));
805
+ return (entry, next) => {
806
+ const meta = entry.meta;
807
+ const context = entry.context;
808
+ const ua = (sourceField ? meta[sourceField] : void 0) || meta.userAgent || meta["user-agent"] || _optionalChain([context, 'optionalAccess', _32 => _32.userAgent]) || _optionalChain([context, 'optionalAccess', _33 => _33["user-agent"]]);
809
+ if (ua) {
810
+ const info = parseUserAgent(ua);
811
+ entry.meta = {
812
+ ...entry.meta,
813
+ [targetField]: info
814
+ };
815
+ }
816
+ next(entry);
817
+ };
818
+ }
819
+ function parseUserAgent(ua) {
820
+ const browser = /(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i.exec(ua) || [];
821
+ let name = browser[1] ? browser[1].toLowerCase() : "unknown";
822
+ let version = browser[2] || "unknown";
823
+ if (/trident/i.test(name)) {
824
+ name = "ie";
825
+ } else if (name === "chrome") {
826
+ const edge = /edg(e)?\/(\d+)/i.exec(ua);
827
+ if (edge) {
828
+ name = "edge";
829
+ version = edge[2];
830
+ }
831
+ }
832
+ const osResult = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.exec(
833
+ ua
834
+ );
835
+ const os = osResult ? osResult[0].toLowerCase() : "desktop";
836
+ return { browser: name, version, os };
837
+ }
838
+
839
+ // src/transports/batch.ts
840
+ function batchTransport(inner, options = {}) {
841
+ const batchSize = _nullishCoalesce(options.batchSize, () => ( 100));
842
+ const flushIntervalMs = _nullishCoalesce(options.flushIntervalMs, () => ( 5e3));
843
+ let buffer = [];
844
+ let flushTimer = null;
845
+ function scheduleFlush() {
846
+ if (flushTimer) return;
847
+ flushTimer = setTimeout(() => {
848
+ flushTimer = null;
849
+ doFlush();
850
+ }, flushIntervalMs);
851
+ }
852
+ function doFlush() {
853
+ if (buffer.length === 0) return;
854
+ const batch = buffer;
855
+ buffer = [];
856
+ for (const entry of batch) {
857
+ try {
858
+ const result = inner.write(entry);
859
+ if (result && typeof result.catch === "function") {
860
+ result.catch(() => {
861
+ });
862
+ }
863
+ } catch (e8) {
864
+ }
865
+ }
866
+ }
867
+ return {
868
+ name: `batch(${inner.name})`,
869
+ level: inner.level,
870
+ write(entry) {
871
+ buffer.push(entry);
872
+ if (buffer.length >= batchSize) {
873
+ doFlush();
874
+ } else {
875
+ scheduleFlush();
876
+ }
877
+ },
878
+ async flush() {
879
+ if (flushTimer) {
880
+ clearTimeout(flushTimer);
881
+ flushTimer = null;
882
+ }
883
+ doFlush();
884
+ await _optionalChain([inner, 'access', _34 => _34.flush, 'optionalCall', _35 => _35()]);
885
+ },
886
+ async close() {
887
+ await _optionalChain([this, 'access', _36 => _36.flush, 'optionalCall', _37 => _37()]);
888
+ await _optionalChain([inner, 'access', _38 => _38.close, 'optionalCall', _39 => _39()]);
889
+ }
890
+ };
891
+ }
892
+
893
+ // src/transports/browser-json-stream.ts
894
+ function browserJsonStreamTransport(options) {
895
+ const stream = options.stream;
896
+ const writer = stream.getWriter();
897
+ const serialize = _nullishCoalesce(options.serializer, () => ( ((entry) => `${JSON.stringify(entry)}
898
+ `)));
899
+ return {
900
+ name: "browser-stream",
901
+ level: options.level,
902
+ async write(entry) {
903
+ try {
904
+ const data = serialize(entry);
905
+ await writer.ready;
906
+ await writer.write(data);
907
+ } catch (err) {
908
+ console.error("[voltlog] Failed to write to browser stream", err);
909
+ }
910
+ },
911
+ async close() {
912
+ try {
913
+ await writer.close();
914
+ } catch (_err) {
915
+ }
916
+ }
917
+ };
918
+ }
919
+
920
+ // src/transports/console.ts
921
+ function consoleTransport(options = {}) {
922
+ const useConsoleLevels = _nullishCoalesce(options.useConsoleLevels, () => ( true));
923
+ const formatter = _nullishCoalesce(options.formatter, () => ( ((entry) => JSON.stringify(entry))));
924
+ return {
925
+ name: "console",
926
+ level: options.level,
927
+ write(entry) {
928
+ const output = formatter(entry);
929
+ if (!useConsoleLevels) {
930
+ console.log(output);
931
+ return;
932
+ }
933
+ if (entry.level >= LogLevel.FATAL) {
934
+ console.error(output);
935
+ } else if (entry.level >= LogLevel.ERROR) {
936
+ console.error(output);
937
+ } else if (entry.level >= LogLevel.WARN) {
938
+ console.warn(output);
939
+ } else if (entry.level >= LogLevel.INFO) {
940
+ console.info(output);
941
+ } else if (entry.level >= LogLevel.DEBUG) {
942
+ console.debug(output);
943
+ } else {
944
+ console.log(output);
945
+ }
946
+ }
947
+ };
948
+ }
949
+
950
+ // src/transports/create-transport.ts
951
+ function createTransport(name, write, options = {}) {
952
+ return {
953
+ name,
954
+ write,
955
+ ...options
956
+ };
957
+ }
958
+
959
+ // src/transports/datadog.ts
960
+ function datadogTransport(options) {
961
+ const {
962
+ apiKey,
963
+ site = "datadoghq.com",
964
+ service,
965
+ ddSource = "nodejs",
966
+ hostname,
967
+ tags,
968
+ level
969
+ } = options;
970
+ const url = `https://http-intake.logs.${site}/api/v2/logs`;
971
+ return {
972
+ name: "datadog",
973
+ level,
974
+ async write(entry) {
975
+ const payload = {
976
+ ddsource: ddSource,
977
+ ddtags: tags,
978
+ hostname,
979
+ service,
980
+ message: entry.message,
981
+ status: entry.levelName.toLowerCase(),
982
+ // Datadog uses lowercase status
983
+ ...entry.meta,
984
+ timestamp: entry.timestamp
985
+ // Datadog auto-parses this
986
+ };
987
+ try {
988
+ await fetch(url, {
989
+ method: "POST",
990
+ headers: {
991
+ "Content-Type": "application/json",
992
+ "DD-API-KEY": apiKey
993
+ },
994
+ body: JSON.stringify(payload)
995
+ });
996
+ } catch (err) {
997
+ console.error("[voltlog] Datadog push failed", err);
998
+ }
999
+ }
1000
+ };
1001
+ }
1002
+
1003
+ // src/transports/discord.ts
1004
+ function discordTransport(options) {
1005
+ const { webhookUrl, username, avatarUrl, level = "ERROR" } = options;
1006
+ return {
1007
+ name: "discord",
1008
+ level,
1009
+ async write(entry) {
1010
+ try {
1011
+ await fetch(webhookUrl, {
1012
+ method: "POST",
1013
+ headers: { "Content-Type": "application/json" },
1014
+ body: JSON.stringify(
1015
+ formatDiscordPayload(entry, username, avatarUrl)
1016
+ )
1017
+ });
1018
+ } catch (_err) {
1019
+ }
1020
+ }
1021
+ };
1022
+ }
1023
+ function formatDiscordPayload(entry, username, avatar_url) {
1024
+ const color = getLevelColor(entry.level);
1025
+ return {
1026
+ username: username || "VoltLog",
1027
+ avatar_url,
1028
+ embeds: [
1029
+ {
1030
+ title: `${entry.levelName} - ${entry.message}`,
1031
+ color,
1032
+ timestamp: new Date(entry.timestamp).toISOString(),
1033
+ fields: [
1034
+ {
1035
+ name: "Meta",
1036
+ value: `\`\`\`json
1037
+ ${JSON.stringify(entry.meta, null, 2).slice(
1038
+ 0,
1039
+ 1e3
1040
+ )}
1041
+ \`\`\``
1042
+ },
1043
+ _optionalChain([entry, 'access', _40 => _40.error, 'optionalAccess', _41 => _41.stack]) ? {
1044
+ name: "Stack",
1045
+ value: `\`\`\`js
1046
+ ${entry.error.stack.slice(0, 1e3)}
1047
+ \`\`\``
1048
+ } : null
1049
+ ].filter(Boolean)
1050
+ }
1051
+ ]
1052
+ };
1053
+ }
1054
+ function getLevelColor(level) {
1055
+ if (level >= 50) return 15158332;
1056
+ if (level >= 40) return 16776960;
1057
+ if (level >= 30) return 3447003;
1058
+ return 9807270;
1059
+ }
1060
+
99
1061
  // src/transports/file.ts
100
1062
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
101
1063
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -141,7 +1103,7 @@ function fileTransport(options) {
141
1103
  try {
142
1104
  const stat = _fs2.default.statSync(filePath);
143
1105
  currentSize = stat.size;
144
- } catch (e) {
1106
+ } catch (e9) {
145
1107
  }
146
1108
  currentStream.on("error", (err) => {
147
1109
  console.error(`[voltlog] File write error to ${filePath}:`, err);
@@ -176,7 +1138,7 @@ function fileTransport(options) {
176
1138
  async close() {
177
1139
  if (currentStream) {
178
1140
  return new Promise((resolve) => {
179
- _optionalChain([currentStream, 'optionalAccess', _ => _.end, 'call', _2 => _2(() => resolve())]);
1141
+ _optionalChain([currentStream, 'optionalAccess', _42 => _42.end, 'call', _43 => _43(() => resolve())]);
180
1142
  });
181
1143
  }
182
1144
  }
@@ -207,6 +1169,431 @@ function jsonStreamTransport(options) {
207
1169
  };
208
1170
  }
209
1171
 
1172
+ // src/transports/loki.ts
1173
+ function lokiTransport(options) {
1174
+ const { host, level } = options;
1175
+ const staticLabels = _nullishCoalesce(options.labels, () => ( { app: "voltlog" }));
1176
+ const batchSize = _nullishCoalesce(options.batchSize, () => ( 10));
1177
+ const interval = _nullishCoalesce(options.interval, () => ( 5e3));
1178
+ const includeMetadata = options.includeMetadata !== false;
1179
+ const retryEnabled = _nullishCoalesce(options.retry, () => ( false));
1180
+ const maxRetries = _nullishCoalesce(options.maxRetries, () => ( 3));
1181
+ const url = `${host.replace(/\/$/, "")}/loki/api/v1/push`;
1182
+ const headers = {
1183
+ "Content-Type": "application/json"
1184
+ };
1185
+ if (options.basicAuthUser && options.basicAuthPassword) {
1186
+ const creds = btoa(`${options.basicAuthUser}:${options.basicAuthPassword}`);
1187
+ headers.Authorization = `Basic ${creds}`;
1188
+ }
1189
+ if (options.tenantId) {
1190
+ headers["X-Scope-OrgID"] = options.tenantId;
1191
+ }
1192
+ let buffer = [];
1193
+ let timer = null;
1194
+ function buildLogLine(entry) {
1195
+ const payload = {
1196
+ level: entry.levelName,
1197
+ message: entry.message,
1198
+ ...entry.meta
1199
+ };
1200
+ if (includeMetadata) {
1201
+ if (entry.correlationId) {
1202
+ payload.correlationId = entry.correlationId;
1203
+ }
1204
+ if (entry.context) {
1205
+ payload.context = entry.context;
1206
+ }
1207
+ if (entry.error) {
1208
+ payload.error = entry.error;
1209
+ }
1210
+ }
1211
+ return JSON.stringify(payload);
1212
+ }
1213
+ function buildStreams(batch) {
1214
+ if (!options.dynamicLabels) {
1215
+ return [
1216
+ {
1217
+ stream: staticLabels,
1218
+ values: batch.map((e) => [
1219
+ String(e.timestamp * 1e6),
1220
+ // Loki wants nanoseconds
1221
+ buildLogLine(e)
1222
+ ])
1223
+ }
1224
+ ];
1225
+ }
1226
+ const grouped = /* @__PURE__ */ new Map();
1227
+ for (const entry of batch) {
1228
+ const dynamic = options.dynamicLabels(entry);
1229
+ const merged = { ...staticLabels };
1230
+ for (const [k, v] of Object.entries(dynamic)) {
1231
+ if (v !== void 0) merged[k] = v;
1232
+ }
1233
+ const key = JSON.stringify(merged);
1234
+ let group = grouped.get(key);
1235
+ if (!group) {
1236
+ group = { labels: merged, values: [] };
1237
+ grouped.set(key, group);
1238
+ }
1239
+ group.values.push([
1240
+ String(entry.timestamp * 1e6),
1241
+ buildLogLine(entry)
1242
+ ]);
1243
+ }
1244
+ return Array.from(grouped.values()).map((g) => ({
1245
+ stream: g.labels,
1246
+ values: g.values
1247
+ }));
1248
+ }
1249
+ async function pushWithRetry(batch) {
1250
+ const body = JSON.stringify({ streams: buildStreams(batch) });
1251
+ let lastError;
1252
+ const attempts = retryEnabled ? maxRetries : 1;
1253
+ for (let attempt = 0; attempt < attempts; attempt++) {
1254
+ try {
1255
+ const response = await fetch(url, { method: "POST", headers, body });
1256
+ if (response.ok) return;
1257
+ if (response.status >= 400 && response.status < 500) {
1258
+ console.error(`[voltlog] Loki push failed: ${response.status}`);
1259
+ return;
1260
+ }
1261
+ lastError = new Error(`Loki HTTP ${response.status}`);
1262
+ } catch (err) {
1263
+ lastError = err;
1264
+ }
1265
+ if (attempt < attempts - 1) {
1266
+ await new Promise((r) => setTimeout(r, 100 * 2 ** attempt));
1267
+ }
1268
+ }
1269
+ console.error("[voltlog] Loki push failed after retries", lastError);
1270
+ }
1271
+ const doFlush = async () => {
1272
+ if (buffer.length === 0) return;
1273
+ const batch = buffer;
1274
+ buffer = [];
1275
+ await pushWithRetry(batch);
1276
+ };
1277
+ const schedule = () => {
1278
+ if (!timer) {
1279
+ timer = setTimeout(() => {
1280
+ timer = null;
1281
+ doFlush();
1282
+ }, interval);
1283
+ }
1284
+ };
1285
+ return {
1286
+ name: "loki",
1287
+ level,
1288
+ write(entry) {
1289
+ buffer.push(entry);
1290
+ if (buffer.length >= batchSize) {
1291
+ if (timer) clearTimeout(timer);
1292
+ timer = null;
1293
+ doFlush();
1294
+ } else {
1295
+ schedule();
1296
+ }
1297
+ },
1298
+ async flush() {
1299
+ if (timer) clearTimeout(timer);
1300
+ await doFlush();
1301
+ },
1302
+ async close() {
1303
+ await _optionalChain([this, 'access', _44 => _44.flush, 'optionalCall', _45 => _45()]);
1304
+ }
1305
+ };
1306
+ }
1307
+
1308
+ // src/transports/otel.ts
1309
+ var OTEL_SEVERITY_MAP = {
1310
+ TRACE: { number: 1, text: "TRACE" },
1311
+ DEBUG: { number: 5, text: "DEBUG" },
1312
+ INFO: { number: 9, text: "INFO" },
1313
+ WARN: { number: 13, text: "WARN" },
1314
+ ERROR: { number: 17, text: "ERROR" },
1315
+ FATAL: { number: 21, text: "FATAL" }
1316
+ };
1317
+ function otelTransport(options) {
1318
+ const { endpoint, serviceName, level, resource = {} } = options;
1319
+ const batchSize = _nullishCoalesce(options.batchSize, () => ( 20));
1320
+ const interval = _nullishCoalesce(options.interval, () => ( 5e3));
1321
+ const url = `${endpoint.replace(/\/$/, "")}/v1/logs`;
1322
+ const headers = {
1323
+ "Content-Type": "application/json",
1324
+ ...options.headers
1325
+ };
1326
+ const resourceAttributes = [
1327
+ { key: "service.name", value: { stringValue: serviceName } },
1328
+ ...Object.entries(resource).map(([key, val]) => ({
1329
+ key,
1330
+ value: { stringValue: val }
1331
+ }))
1332
+ ];
1333
+ let buffer = [];
1334
+ let timer = null;
1335
+ function toOtlpLogRecord(entry) {
1336
+ const severity = _nullishCoalesce(OTEL_SEVERITY_MAP[entry.levelName], () => ( OTEL_SEVERITY_MAP.INFO));
1337
+ const attributes = [];
1338
+ if (entry.meta && typeof entry.meta === "object") {
1339
+ for (const [key, val] of Object.entries(entry.meta)) {
1340
+ if (key === "traceId" || key === "spanId" || key === "traceFlags")
1341
+ continue;
1342
+ if (val !== void 0 && val !== null) {
1343
+ attributes.push({
1344
+ key,
1345
+ value: typeof val === "number" ? { intValue: val } : { stringValue: String(val) }
1346
+ });
1347
+ }
1348
+ }
1349
+ }
1350
+ if (entry.context) {
1351
+ for (const [key, val] of Object.entries(entry.context)) {
1352
+ if (val !== void 0 && val !== null) {
1353
+ attributes.push({
1354
+ key: `context.${key}`,
1355
+ value: { stringValue: String(val) }
1356
+ });
1357
+ }
1358
+ }
1359
+ }
1360
+ if (entry.error) {
1361
+ attributes.push({
1362
+ key: "error.message",
1363
+ value: { stringValue: entry.error.message }
1364
+ });
1365
+ if (entry.error.name) {
1366
+ attributes.push({
1367
+ key: "error.type",
1368
+ value: { stringValue: entry.error.name }
1369
+ });
1370
+ }
1371
+ if (entry.error.stack) {
1372
+ attributes.push({
1373
+ key: "error.stack",
1374
+ value: { stringValue: entry.error.stack }
1375
+ });
1376
+ }
1377
+ }
1378
+ const record = {
1379
+ timeUnixNano: String(entry.timestamp * 1e6),
1380
+ // ms → ns
1381
+ severityNumber: _optionalChain([severity, 'optionalAccess', _46 => _46.number]),
1382
+ severityText: _optionalChain([severity, 'optionalAccess', _47 => _47.text]),
1383
+ body: { stringValue: entry.message },
1384
+ attributes
1385
+ };
1386
+ const meta = entry.meta;
1387
+ if (_optionalChain([meta, 'optionalAccess', _48 => _48.traceId])) {
1388
+ record.traceId = meta.traceId;
1389
+ }
1390
+ if (_optionalChain([meta, 'optionalAccess', _49 => _49.spanId])) {
1391
+ record.spanId = meta.spanId;
1392
+ }
1393
+ if (_optionalChain([meta, 'optionalAccess', _50 => _50.traceFlags]) !== void 0) {
1394
+ record.flags = meta.traceFlags;
1395
+ }
1396
+ return record;
1397
+ }
1398
+ async function sendBatch(batch) {
1399
+ const payload = {
1400
+ resourceLogs: [
1401
+ {
1402
+ resource: { attributes: resourceAttributes },
1403
+ scopeLogs: [
1404
+ {
1405
+ scope: { name: "voltlog-io" },
1406
+ logRecords: batch.map(toOtlpLogRecord)
1407
+ }
1408
+ ]
1409
+ }
1410
+ ]
1411
+ };
1412
+ try {
1413
+ const response = await fetch(url, {
1414
+ method: "POST",
1415
+ headers,
1416
+ body: JSON.stringify(payload)
1417
+ });
1418
+ if (!response.ok) {
1419
+ console.error(
1420
+ `[voltlog] OTLP push failed: ${response.status} ${response.statusText}`
1421
+ );
1422
+ }
1423
+ } catch (err) {
1424
+ console.error("[voltlog] OTLP push failed", err);
1425
+ }
1426
+ }
1427
+ function flush() {
1428
+ if (buffer.length === 0) return;
1429
+ const batch = buffer;
1430
+ buffer = [];
1431
+ sendBatch(batch).catch(() => {
1432
+ });
1433
+ }
1434
+ function schedule() {
1435
+ if (!timer) {
1436
+ timer = setTimeout(() => {
1437
+ timer = null;
1438
+ flush();
1439
+ }, interval);
1440
+ }
1441
+ }
1442
+ return {
1443
+ name: "otel",
1444
+ level,
1445
+ write(entry) {
1446
+ buffer.push(entry);
1447
+ if (buffer.length >= batchSize) {
1448
+ if (timer) clearTimeout(timer);
1449
+ timer = null;
1450
+ flush();
1451
+ } else {
1452
+ schedule();
1453
+ }
1454
+ },
1455
+ async flush() {
1456
+ if (timer) clearTimeout(timer);
1457
+ timer = null;
1458
+ if (buffer.length === 0) return;
1459
+ const batch = buffer;
1460
+ buffer = [];
1461
+ await sendBatch(batch);
1462
+ },
1463
+ async close() {
1464
+ await _optionalChain([this, 'access', _51 => _51.flush, 'optionalCall', _52 => _52()]);
1465
+ }
1466
+ };
1467
+ }
1468
+
1469
+ // src/transports/pretty.ts
1470
+ var RESET = "\x1B[0m";
1471
+ var DIM = "\x1B[2m";
1472
+ var BOLD = "\x1B[1m";
1473
+ var COLORS = {
1474
+ TRACE: "\x1B[90m",
1475
+ // gray
1476
+ DEBUG: "\x1B[36m",
1477
+ // cyan
1478
+ INFO: "\x1B[32m",
1479
+ // green
1480
+ WARN: "\x1B[33m",
1481
+ // yellow
1482
+ ERROR: "\x1B[31m",
1483
+ // red
1484
+ FATAL: "\x1B[35;1m"
1485
+ // bold magenta
1486
+ };
1487
+ var ICONS = {
1488
+ TRACE: "\u{1F50D}",
1489
+ DEBUG: "\u{1F41B}",
1490
+ INFO: "\u2139",
1491
+ WARN: "\u26A0",
1492
+ ERROR: "\u2716",
1493
+ FATAL: "\u{1F480}"
1494
+ };
1495
+ var EXCHANGE_ICONS = {
1496
+ CALL: "\u26A1",
1497
+ CALLRESULT: "\u2714",
1498
+ CALLERROR: "\u{1F6A8}"
1499
+ };
1500
+ var DIRECTION_ARROWS = {
1501
+ IN: "\u2192",
1502
+ OUT: "\u2190"
1503
+ };
1504
+ function prettyTransport(options = {}) {
1505
+ const showTimestamps = _nullishCoalesce(options.timestamps, () => ( true));
1506
+ const useColors = _nullishCoalesce(options.colors, () => ( true));
1507
+ const hideMeta = _nullishCoalesce(options.hideMeta, () => ( false));
1508
+ const prettyMeta = _nullishCoalesce(options.prettyMeta, () => ( false));
1509
+ function colorize(text, color) {
1510
+ return useColors ? `${color}${text}${RESET}` : text;
1511
+ }
1512
+ function formatExchange(entry) {
1513
+ const meta = entry.meta;
1514
+ if (!meta || !meta.action || !meta.messageType) return null;
1515
+ const icon = _nullishCoalesce(EXCHANGE_ICONS[meta.messageType], () => ( "\u2022"));
1516
+ const arrow = _nullishCoalesce(DIRECTION_ARROWS[_nullishCoalesce(meta.direction, () => ( "IN"))], () => ( "\u2192"));
1517
+ const cpId = _nullishCoalesce(meta.chargePointId, () => ( "unknown"));
1518
+ const action = meta.action;
1519
+ const msgType = meta.messageType;
1520
+ const dir = _nullishCoalesce(meta.direction, () => ( ""));
1521
+ let line = `${icon} ${colorize(cpId, BOLD)} ${arrow} ${colorize(
1522
+ action,
1523
+ BOLD
1524
+ )} [${dir}] ${colorize(msgType, DIM)}`;
1525
+ if (meta.status || meta.latencyMs !== void 0) {
1526
+ const statusIcon = meta.messageType === "CALLERROR" ? "\u274C" : "\u2714";
1527
+ const status = _nullishCoalesce(meta.status, () => ( ""));
1528
+ const latency = meta.latencyMs !== void 0 ? `(${meta.latencyMs}ms)` : "";
1529
+ line += `
1530
+ ${statusIcon} ${status} ${colorize(latency, DIM)}`;
1531
+ }
1532
+ return line;
1533
+ }
1534
+ function formatStandard(entry) {
1535
+ const icon = _nullishCoalesce(ICONS[entry.levelName], () => ( "\u2022"));
1536
+ const levelColor = _nullishCoalesce(COLORS[entry.levelName], () => ( ""));
1537
+ const level = colorize(entry.levelName.padEnd(5), levelColor);
1538
+ const ts = showTimestamps ? `${colorize(new Date(entry.timestamp).toISOString(), DIM)} ` : "";
1539
+ let line = `${icon} ${ts}${level} ${entry.message}`;
1540
+ if (entry.context && Object.keys(entry.context).length > 0) {
1541
+ const kvStr = Object.entries(entry.context).map(
1542
+ ([k, v]) => `${k}:${typeof v === "string" ? v : JSON.stringify(v)}`
1543
+ ).join(" ");
1544
+ line += ` ${colorize(kvStr, DIM)}`;
1545
+ }
1546
+ if (!hideMeta && entry.meta && Object.keys(entry.meta).length > 0) {
1547
+ if (prettyMeta) {
1548
+ const metaEntries = Object.entries(
1549
+ entry.meta
1550
+ );
1551
+ const parts = metaEntries.map(([key, value]) => {
1552
+ const valStr = typeof value === "string" ? value : JSON.stringify(value);
1553
+ return `${colorize(`${key}:`, DIM)}${valStr}`;
1554
+ });
1555
+ line += ` ${parts.join(" ")}`;
1556
+ } else {
1557
+ const kvStr = Object.entries(entry.meta).map(
1558
+ ([k, v]) => `${k}:${typeof v === "string" ? v : JSON.stringify(v)}`
1559
+ ).join(" ");
1560
+ line += ` ${colorize(kvStr, DIM)}`;
1561
+ }
1562
+ }
1563
+ if (entry.error) {
1564
+ line += `
1565
+ ${colorize(
1566
+ `${_nullishCoalesce(entry.error.name, () => ( "Error"))}: ${entry.error.message}`,
1567
+ _nullishCoalesce(COLORS.ERROR, () => ( ""))
1568
+ )}`;
1569
+ if (entry.error.stack) {
1570
+ line += `
1571
+ ${colorize(entry.error.stack, DIM)}`;
1572
+ }
1573
+ }
1574
+ return line;
1575
+ }
1576
+ return {
1577
+ name: "pretty",
1578
+ level: options.level,
1579
+ write(entry) {
1580
+ const exchangeOutput = formatExchange(entry);
1581
+ if (exchangeOutput) {
1582
+ console.log(exchangeOutput);
1583
+ return;
1584
+ }
1585
+ const output = formatStandard(entry);
1586
+ if (entry.level >= LogLevel.ERROR) {
1587
+ console.error(output);
1588
+ } else if (entry.level >= LogLevel.WARN) {
1589
+ console.warn(output);
1590
+ } else {
1591
+ console.log(output);
1592
+ }
1593
+ }
1594
+ };
1595
+ }
1596
+
210
1597
  // src/transports/redis.ts
211
1598
  function redisTransport(options) {
212
1599
  const { client, streamKey = "logs", maxLen, level } = options;
@@ -247,6 +1634,283 @@ function redisTransport(options) {
247
1634
  };
248
1635
  }
249
1636
 
1637
+ // src/transports/ring-buffer.ts
1638
+ function ringBufferTransport(options = {}) {
1639
+ const maxSize = _nullishCoalesce(options.maxSize, () => ( 1e3));
1640
+ const buffer = [];
1641
+ let head = 0;
1642
+ let count = 0;
1643
+ return {
1644
+ name: "ring-buffer",
1645
+ level: options.level,
1646
+ write(entry) {
1647
+ if (count < maxSize) {
1648
+ buffer.push(entry);
1649
+ count++;
1650
+ } else {
1651
+ buffer[head] = entry;
1652
+ }
1653
+ head = (head + 1) % maxSize;
1654
+ },
1655
+ getEntries(query) {
1656
+ let entries;
1657
+ if (count < maxSize) {
1658
+ entries = buffer.slice();
1659
+ } else {
1660
+ entries = [...buffer.slice(head), ...buffer.slice(0, head)];
1661
+ }
1662
+ if (_optionalChain([query, 'optionalAccess', _53 => _53.level])) {
1663
+ const minLevel = resolveLevel(query.level);
1664
+ entries = entries.filter((e) => e.level >= minLevel);
1665
+ }
1666
+ if (_optionalChain([query, 'optionalAccess', _54 => _54.since])) {
1667
+ const since = query.since;
1668
+ entries = entries.filter((e) => e.timestamp >= since);
1669
+ }
1670
+ if (_optionalChain([query, 'optionalAccess', _55 => _55.limit])) {
1671
+ entries = entries.slice(-query.limit);
1672
+ }
1673
+ return entries;
1674
+ },
1675
+ clear() {
1676
+ buffer.length = 0;
1677
+ head = 0;
1678
+ count = 0;
1679
+ },
1680
+ get size() {
1681
+ return count;
1682
+ }
1683
+ };
1684
+ }
1685
+
1686
+ // src/transports/sentry.ts
1687
+ function sentryTransport(options) {
1688
+ const { sentry } = options;
1689
+ const errorLevelValue = resolveLevel(_nullishCoalesce(options.errorLevel, () => ( "ERROR")));
1690
+ const breadcrumbLevelValue = resolveLevel(_nullishCoalesce(options.breadcrumbLevel, () => ( "INFO")));
1691
+ return {
1692
+ name: "sentry",
1693
+ write(entry) {
1694
+ if (entry.level >= errorLevelValue) {
1695
+ if (entry.error) {
1696
+ sentry.captureException(entry.error, {
1697
+ extra: {
1698
+ ...entry.meta,
1699
+ context: entry.context
1700
+ },
1701
+ level: "error"
1702
+ });
1703
+ } else {
1704
+ sentry.captureMessage(entry.message, "error");
1705
+ }
1706
+ }
1707
+ if (entry.level >= breadcrumbLevelValue) {
1708
+ sentry.addBreadcrumb({
1709
+ category: "log",
1710
+ message: entry.message,
1711
+ level: mapLevelToSentry(entry.level),
1712
+ data: { ...entry.meta, ...entry.context },
1713
+ timestamp: entry.timestamp / 1e3
1714
+ });
1715
+ }
1716
+ }
1717
+ };
1718
+ }
1719
+ function mapLevelToSentry(level) {
1720
+ if (level >= 60) return "fatal";
1721
+ if (level >= 50) return "error";
1722
+ if (level >= 40) return "warning";
1723
+ if (level >= 30) return "info";
1724
+ return "debug";
1725
+ }
1726
+
1727
+ // src/transports/slack.ts
1728
+ function slackTransport(options) {
1729
+ const { webhookUrl, username, iconEmoji, level } = options;
1730
+ return {
1731
+ name: "slack",
1732
+ level: _nullishCoalesce(level, () => ( "ERROR")),
1733
+ // Default to ERROR to prevent spamming
1734
+ async write(entry) {
1735
+ try {
1736
+ const payload = formatSlackMessage(entry, username, iconEmoji);
1737
+ const response = await fetch(webhookUrl, {
1738
+ method: "POST",
1739
+ headers: { "Content-Type": "application/json" },
1740
+ body: JSON.stringify(payload)
1741
+ });
1742
+ if (!response.ok) {
1743
+ }
1744
+ } catch (_err) {
1745
+ }
1746
+ }
1747
+ };
1748
+ }
1749
+ function formatSlackMessage(entry, username, icon_emoji) {
1750
+ const levelEmoji = getLevelEmoji(entry.level);
1751
+ const color = getLevelColor2(entry.level);
1752
+ const blocks = [
1753
+ {
1754
+ type: "header",
1755
+ text: {
1756
+ type: "plain_text",
1757
+ text: `${levelEmoji} ${entry.levelName}: ${entry.message}`,
1758
+ emoji: true
1759
+ }
1760
+ },
1761
+ {
1762
+ type: "context",
1763
+ elements: [
1764
+ {
1765
+ type: "mrkdwn",
1766
+ text: `*Time:* ${new Date(entry.timestamp).toISOString()}`
1767
+ },
1768
+ {
1769
+ type: "mrkdwn",
1770
+ text: `*ID:* \`${entry.id}\``
1771
+ }
1772
+ ]
1773
+ }
1774
+ ];
1775
+ if (entry.correlationId) {
1776
+ blocks[1].elements.push({
1777
+ type: "mrkdwn",
1778
+ text: `*Trace:* \`${entry.correlationId}\``
1779
+ });
1780
+ }
1781
+ if (Object.keys(entry.meta).length > 0) {
1782
+ blocks.push({
1783
+ type: "section",
1784
+ text: {
1785
+ type: "mrkdwn",
1786
+ text: `*Metadata:*
1787
+ \`\`\`${JSON.stringify(entry.meta, null, 2)}\`\`\``,
1788
+ emoji: true
1789
+ }
1790
+ });
1791
+ }
1792
+ if (_optionalChain([entry, 'access', _56 => _56.error, 'optionalAccess', _57 => _57.stack])) {
1793
+ blocks.push({
1794
+ type: "section",
1795
+ text: {
1796
+ type: "mrkdwn",
1797
+ text: `*Error Stack:*
1798
+ \`\`\`${entry.error.stack}\`\`\``,
1799
+ emoji: true
1800
+ }
1801
+ });
1802
+ }
1803
+ return {
1804
+ username,
1805
+ icon_emoji,
1806
+ attachments: [
1807
+ {
1808
+ color,
1809
+ blocks
1810
+ }
1811
+ ]
1812
+ };
1813
+ }
1814
+ function getLevelEmoji(level) {
1815
+ if (level >= 60) return "\u{1F525}";
1816
+ if (level >= 50) return "\u{1F6A8}";
1817
+ if (level >= 40) return "\u26A0\uFE0F";
1818
+ if (level >= 30) return "\u2139\uFE0F";
1819
+ if (level >= 20) return "\u{1F41B}";
1820
+ return "\u{1F50D}";
1821
+ }
1822
+ function getLevelColor2(level) {
1823
+ if (level >= 60) return "#ff0000";
1824
+ if (level >= 50) return "#ff4444";
1825
+ if (level >= 40) return "#ffbb33";
1826
+ if (level >= 30) return "#33b5e5";
1827
+ if (level >= 20) return "#99cc00";
1828
+ return "#aa66cc";
1829
+ }
1830
+
1831
+ // src/transports/webhook.ts
1832
+ function webhookTransport(options) {
1833
+ const {
1834
+ url,
1835
+ method = "POST",
1836
+ headers = {},
1837
+ batchSize = 1,
1838
+ flushIntervalMs = 5e3,
1839
+ retry = false,
1840
+ maxRetries = 3
1841
+ } = options;
1842
+ const serialize = _nullishCoalesce(options.serializer, () => ( ((entries) => JSON.stringify({
1843
+ entries,
1844
+ count: entries.length,
1845
+ timestamp: Date.now()
1846
+ }))));
1847
+ let buffer = [];
1848
+ let flushTimer = null;
1849
+ async function sendBatch(entries, attempt = 0) {
1850
+ try {
1851
+ const response = await fetch(url, {
1852
+ method,
1853
+ headers: {
1854
+ "Content-Type": "application/json",
1855
+ ...headers
1856
+ },
1857
+ body: serialize(entries)
1858
+ });
1859
+ if (!response.ok && retry && attempt < maxRetries) {
1860
+ const delay = Math.min(1e3 * 2 ** attempt, 3e4);
1861
+ await new Promise((r) => setTimeout(r, delay));
1862
+ return sendBatch(entries, attempt + 1);
1863
+ }
1864
+ } catch (e10) {
1865
+ if (retry && attempt < maxRetries) {
1866
+ const delay = Math.min(1e3 * 2 ** attempt, 3e4);
1867
+ await new Promise((r) => setTimeout(r, delay));
1868
+ return sendBatch(entries, attempt + 1);
1869
+ }
1870
+ }
1871
+ }
1872
+ function scheduleFlush() {
1873
+ if (flushTimer) return;
1874
+ flushTimer = setTimeout(() => {
1875
+ flushTimer = null;
1876
+ doFlush();
1877
+ }, flushIntervalMs);
1878
+ }
1879
+ function doFlush() {
1880
+ if (buffer.length === 0) return;
1881
+ const batch = buffer;
1882
+ buffer = [];
1883
+ sendBatch(batch).catch(() => {
1884
+ });
1885
+ }
1886
+ return {
1887
+ name: "webhook",
1888
+ level: options.level,
1889
+ write(entry) {
1890
+ buffer.push(entry);
1891
+ if (buffer.length >= batchSize) {
1892
+ doFlush();
1893
+ } else {
1894
+ scheduleFlush();
1895
+ }
1896
+ },
1897
+ async flush() {
1898
+ if (flushTimer) {
1899
+ clearTimeout(flushTimer);
1900
+ flushTimer = null;
1901
+ }
1902
+ if (buffer.length > 0) {
1903
+ const batch = buffer;
1904
+ buffer = [];
1905
+ await sendBatch(batch);
1906
+ }
1907
+ },
1908
+ async close() {
1909
+ await _optionalChain([this, 'access', _58 => _58.flush, 'optionalCall', _59 => _59()]);
1910
+ }
1911
+ };
1912
+ }
1913
+
250
1914
 
251
1915
 
252
1916
 
@@ -287,5 +1951,5 @@ function redisTransport(options) {
287
1951
 
288
1952
 
289
1953
 
290
- exports.LogLevel = _chunk4WQ4K5BMjs.LogLevel; exports.LogLevelNameMap = _chunk4WQ4K5BMjs.LogLevelNameMap; exports.LogLevelValueMap = _chunk4WQ4K5BMjs.LogLevelValueMap; exports.aiEnrichmentMiddleware = _chunk4WQ4K5BMjs.aiEnrichmentMiddleware; exports.alertMiddleware = _chunk4WQ4K5BMjs.alertMiddleware; exports.asyncContextMiddleware = asyncContextMiddleware; exports.batchTransport = _chunk4WQ4K5BMjs.batchTransport; exports.browserJsonStreamTransport = _chunk4WQ4K5BMjs.browserJsonStreamTransport; exports.consoleTransport = _chunk4WQ4K5BMjs.consoleTransport; exports.correlationIdMiddleware = correlationIdMiddleware; exports.createHttpLogger = _chunk4WQ4K5BMjs.createHttpLogger; exports.createLogger = _chunk4WQ4K5BMjs.createLogger; exports.createMiddleware = _chunk4WQ4K5BMjs.createMiddleware; exports.createOpenAiErrorAnalyzer = _chunk4WQ4K5BMjs.createOpenAiErrorAnalyzer; exports.createTransport = _chunk4WQ4K5BMjs.createTransport; exports.datadogTransport = _chunk4WQ4K5BMjs.datadogTransport; exports.deduplicationMiddleware = _chunk4WQ4K5BMjs.deduplicationMiddleware; exports.discordTransport = _chunk4WQ4K5BMjs.discordTransport; exports.fileTransport = fileTransport; exports.heapUsageMiddleware = _chunk4WQ4K5BMjs.heapUsageMiddleware; exports.ipMiddleware = _chunk4WQ4K5BMjs.ipMiddleware; exports.jsonStreamTransport = jsonStreamTransport; exports.levelOverrideMiddleware = _chunk4WQ4K5BMjs.levelOverrideMiddleware; exports.lokiTransport = _chunk4WQ4K5BMjs.lokiTransport; exports.nodeHttpMappers = _chunk4WQ4K5BMjs.nodeHttpMappers; exports.ocppMiddleware = _chunk4WQ4K5BMjs.ocppMiddleware; exports.otelTraceMiddleware = _chunk4WQ4K5BMjs.otelTraceMiddleware; exports.otelTransport = _chunk4WQ4K5BMjs.otelTransport; exports.prettyTransport = _chunk4WQ4K5BMjs.prettyTransport; exports.redactionMiddleware = _chunk4WQ4K5BMjs.redactionMiddleware; exports.redisTransport = redisTransport; exports.resolveLevel = _chunk4WQ4K5BMjs.resolveLevel; exports.ringBufferTransport = _chunk4WQ4K5BMjs.ringBufferTransport; exports.samplingMiddleware = _chunk4WQ4K5BMjs.samplingMiddleware; exports.sentryTransport = _chunk4WQ4K5BMjs.sentryTransport; exports.shouldIncludeStack = _chunk4WQ4K5BMjs.shouldIncludeStack; exports.shouldLog = _chunk4WQ4K5BMjs.shouldLog; exports.slackTransport = _chunk4WQ4K5BMjs.slackTransport; exports.userAgentMiddleware = _chunk4WQ4K5BMjs.userAgentMiddleware; exports.webhookTransport = _chunk4WQ4K5BMjs.webhookTransport;
1954
+ exports.LogLevel = LogLevel; exports.LogLevelNameMap = LogLevelNameMap; exports.LogLevelValueMap = LogLevelValueMap; exports.aiEnrichmentMiddleware = aiEnrichmentMiddleware; exports.alertMiddleware = alertMiddleware; exports.asyncContextMiddleware = asyncContextMiddleware; exports.batchTransport = batchTransport; exports.browserJsonStreamTransport = browserJsonStreamTransport; exports.consoleTransport = consoleTransport; exports.correlationIdMiddleware = correlationIdMiddleware; exports.createHttpLogger = createHttpLogger; exports.createLogger = createLogger; exports.createMiddleware = createMiddleware; exports.createOpenAiErrorAnalyzer = createOpenAiErrorAnalyzer; exports.createTransport = createTransport; exports.datadogTransport = datadogTransport; exports.deduplicationMiddleware = deduplicationMiddleware; exports.discordTransport = discordTransport; exports.fileTransport = fileTransport; exports.heapUsageMiddleware = heapUsageMiddleware; exports.ipMiddleware = ipMiddleware; exports.jsonStreamTransport = jsonStreamTransport; exports.levelOverrideMiddleware = levelOverrideMiddleware; exports.lokiTransport = lokiTransport; exports.nodeHttpMappers = nodeHttpMappers; exports.ocppMiddleware = ocppMiddleware; exports.otelTraceMiddleware = otelTraceMiddleware; exports.otelTransport = otelTransport; exports.prettyTransport = prettyTransport; exports.redactionMiddleware = redactionMiddleware; exports.redisTransport = redisTransport; exports.resolveLevel = resolveLevel; exports.ringBufferTransport = ringBufferTransport; exports.samplingMiddleware = samplingMiddleware; exports.sentryTransport = sentryTransport; exports.shouldIncludeStack = shouldIncludeStack; exports.shouldLog = shouldLog; exports.slackTransport = slackTransport; exports.userAgentMiddleware = userAgentMiddleware; exports.webhookTransport = webhookTransport;
291
1955
  //# sourceMappingURL=index.js.map