voltlog-io 1.0.1

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.mjs ADDED
@@ -0,0 +1,1423 @@
1
+ // src/core/types.ts
2
+ var LogLevel = {
3
+ TRACE: 10,
4
+ DEBUG: 20,
5
+ INFO: 30,
6
+ WARN: 40,
7
+ ERROR: 50,
8
+ FATAL: 60,
9
+ SILENT: Infinity
10
+ };
11
+ var LogLevelNameMap = Object.fromEntries(
12
+ Object.entries(LogLevel).map(([k, v]) => [k.toLowerCase(), v])
13
+ );
14
+ var LogLevelValueMap = Object.fromEntries(
15
+ Object.entries(LogLevel).filter(([, v]) => Number.isFinite(v)).map(([k, v]) => [v, k])
16
+ );
17
+
18
+ // src/core/levels.ts
19
+ function resolveLevel(level) {
20
+ const n = LogLevelNameMap[level.toLowerCase()];
21
+ return n !== void 0 ? n : LogLevel.INFO;
22
+ }
23
+ function shouldLog(entryLevel, filterLevel) {
24
+ return entryLevel >= filterLevel;
25
+ }
26
+ function shouldIncludeStack(entryLevel, includeStack) {
27
+ if (typeof includeStack === "boolean") return includeStack;
28
+ return entryLevel >= resolveLevel(includeStack);
29
+ }
30
+
31
+ // src/core/logger.ts
32
+ import { createId } from "@paralleldrive/cuid2";
33
+
34
+ // src/core/pipeline.ts
35
+ function composeMiddleware(middleware, final) {
36
+ if (middleware.length === 0) return final;
37
+ return (entry) => {
38
+ let index = 0;
39
+ const next = (e) => {
40
+ if (index < middleware.length) {
41
+ const mw = middleware[index++];
42
+ mw(e, next);
43
+ } else {
44
+ final(e);
45
+ }
46
+ };
47
+ next(entry);
48
+ };
49
+ }
50
+ function fanOutToTransports(entry, transports, loggerLevel) {
51
+ for (const t of transports) {
52
+ const tLevel = t.level ? resolveLevel(t.level) : loggerLevel;
53
+ if (!shouldLog(entry.level, tLevel)) continue;
54
+ try {
55
+ const result = t.write(entry);
56
+ if (result && typeof result.catch === "function") {
57
+ result.catch(() => {
58
+ });
59
+ }
60
+ } catch {
61
+ }
62
+ }
63
+ }
64
+
65
+ // src/core/logger.ts
66
+ var LoggerImpl = class {
67
+ _level;
68
+ _transports;
69
+ _middlewareList;
70
+ _pipeline;
71
+ _context;
72
+ _includeStack;
73
+ _timestampFn;
74
+ constructor(options = {}) {
75
+ this._level = resolveLevel(options.level ?? "INFO");
76
+ this._transports = [...options.transports ?? []];
77
+ this._middlewareList = [...options.middleware ?? []];
78
+ this._context = options.context ? { ...options.context } : {};
79
+ this._includeStack = options.includeStack ?? "ERROR";
80
+ this._timestampFn = options.timestamp ?? Date.now;
81
+ this._pipeline = this._buildPipeline();
82
+ }
83
+ // ─── Log Methods ────────────────────────────────────────────
84
+ trace(message, meta) {
85
+ this._log(10, "TRACE", message, meta);
86
+ }
87
+ debug(message, meta) {
88
+ this._log(20, "DEBUG", message, meta);
89
+ }
90
+ info(message, meta) {
91
+ this._log(30, "INFO", message, meta);
92
+ }
93
+ warn(message, meta) {
94
+ this._log(40, "WARN", message, meta);
95
+ }
96
+ error(message, metaOrError, error) {
97
+ if (metaOrError instanceof Error) {
98
+ this._log(50, "ERROR", message, void 0, metaOrError);
99
+ } else {
100
+ this._log(50, "ERROR", message, metaOrError, error);
101
+ }
102
+ }
103
+ fatal(message, metaOrError, error) {
104
+ if (metaOrError instanceof Error) {
105
+ this._log(60, "FATAL", message, void 0, metaOrError);
106
+ } else {
107
+ this._log(60, "FATAL", message, metaOrError, error);
108
+ }
109
+ }
110
+ // ─── Child Logger ───────────────────────────────────────────
111
+ child(context) {
112
+ return new ChildLoggerImpl(this, { ...this._context, ...context });
113
+ }
114
+ // ─── Dynamic Configuration ─────────────────────────────────
115
+ addTransport(transport) {
116
+ this._transports.push(transport);
117
+ }
118
+ removeTransport(name) {
119
+ this._transports = this._transports.filter((t) => t.name !== name);
120
+ }
121
+ addMiddleware(middleware) {
122
+ this._middlewareList.push(middleware);
123
+ this._pipeline = this._buildPipeline();
124
+ }
125
+ // ─── Lifecycle ──────────────────────────────────────────────
126
+ async flush() {
127
+ await Promise.all(this._transports.map((t) => t.flush?.()).filter(Boolean));
128
+ }
129
+ async close() {
130
+ await this.flush();
131
+ await Promise.all(this._transports.map((t) => t.close?.()).filter(Boolean));
132
+ }
133
+ // ─── Internal ───────────────────────────────────────────────
134
+ /** @internal */
135
+ _log(level, levelName, message, meta, error) {
136
+ this._logWithContext(level, levelName, message, this._context, meta, error);
137
+ }
138
+ /** @internal — used by child loggers to inject bound context */
139
+ _logWithContext(level, levelName, message, context, meta, error) {
140
+ if (!shouldLog(level, this._level)) return;
141
+ const entry = {
142
+ id: createId(),
143
+ level,
144
+ levelName,
145
+ message,
146
+ timestamp: this._timestampFn(),
147
+ meta: meta ?? {},
148
+ context: Object.keys(context).length > 0 ? context : void 0
149
+ };
150
+ if (error) {
151
+ const logError = {
152
+ message: error.message,
153
+ name: error.name,
154
+ code: error.code
155
+ };
156
+ if (shouldIncludeStack(level, this._includeStack)) {
157
+ logError.stack = error.stack;
158
+ }
159
+ entry.error = logError;
160
+ }
161
+ this._pipeline(entry);
162
+ }
163
+ _buildPipeline() {
164
+ return composeMiddleware(this._middlewareList, (entry) => {
165
+ fanOutToTransports(entry, this._transports, this._level);
166
+ });
167
+ }
168
+ };
169
+ var ChildLoggerImpl = class _ChildLoggerImpl {
170
+ constructor(_parent, _context) {
171
+ this._parent = _parent;
172
+ this._context = _context;
173
+ }
174
+ trace(message, meta) {
175
+ this._parent._logWithContext(10, "TRACE", message, this._context, meta);
176
+ }
177
+ debug(message, meta) {
178
+ this._parent._logWithContext(20, "DEBUG", message, this._context, meta);
179
+ }
180
+ info(message, meta) {
181
+ this._parent._logWithContext(30, "INFO", message, this._context, meta);
182
+ }
183
+ warn(message, meta) {
184
+ this._parent._logWithContext(40, "WARN", message, this._context, meta);
185
+ }
186
+ error(message, metaOrError, error) {
187
+ if (metaOrError instanceof Error) {
188
+ this._parent._logWithContext(
189
+ 50,
190
+ "ERROR",
191
+ message,
192
+ this._context,
193
+ void 0,
194
+ metaOrError
195
+ );
196
+ } else {
197
+ this._parent._logWithContext(
198
+ 50,
199
+ "ERROR",
200
+ message,
201
+ this._context,
202
+ metaOrError,
203
+ error
204
+ );
205
+ }
206
+ }
207
+ fatal(message, metaOrError, error) {
208
+ if (metaOrError instanceof Error) {
209
+ this._parent._logWithContext(
210
+ 60,
211
+ "FATAL",
212
+ message,
213
+ this._context,
214
+ void 0,
215
+ metaOrError
216
+ );
217
+ } else {
218
+ this._parent._logWithContext(
219
+ 60,
220
+ "FATAL",
221
+ message,
222
+ this._context,
223
+ metaOrError,
224
+ error
225
+ );
226
+ }
227
+ }
228
+ child(context) {
229
+ return new _ChildLoggerImpl(this._parent, {
230
+ ...this._context,
231
+ ...context
232
+ });
233
+ }
234
+ addTransport(transport) {
235
+ this._parent.addTransport(transport);
236
+ }
237
+ removeTransport(name) {
238
+ this._parent.removeTransport(name);
239
+ }
240
+ addMiddleware(middleware) {
241
+ this._parent.addMiddleware(middleware);
242
+ }
243
+ flush() {
244
+ return this._parent.flush();
245
+ }
246
+ close() {
247
+ return this._parent.close();
248
+ }
249
+ };
250
+ function createLogger(options) {
251
+ return new LoggerImpl(options);
252
+ }
253
+
254
+ // src/middleware/ai-enrichment.ts
255
+ function aiEnrichmentMiddleware(options) {
256
+ const minLevel = resolveLevel(options.level ?? "ERROR");
257
+ const timeoutMs = options.timeout ?? 2e3;
258
+ const swallow = options.swallowErrors ?? true;
259
+ const fieldName = options.targetField ?? "ai_analysis";
260
+ return async (entry, next) => {
261
+ if (entry.level < minLevel) {
262
+ next(entry);
263
+ return;
264
+ }
265
+ try {
266
+ const analysisPromise = options.analyzer(entry);
267
+ const timeoutPromise = new Promise(
268
+ (_, reject) => setTimeout(() => reject(new Error("AI Analysis Timeout")), timeoutMs)
269
+ );
270
+ const result = await Promise.race([analysisPromise, timeoutPromise]);
271
+ if (result) {
272
+ entry.meta = {
273
+ ...entry.meta,
274
+ [fieldName]: result
275
+ };
276
+ }
277
+ } catch (err) {
278
+ if (!swallow) {
279
+ throw err;
280
+ }
281
+ }
282
+ next(entry);
283
+ };
284
+ }
285
+ 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.") {
286
+ return async (entry) => {
287
+ try {
288
+ const response = await fetch(
289
+ "https://api.openai.com/v1/chat/completions",
290
+ {
291
+ method: "POST",
292
+ headers: {
293
+ "Content-Type": "application/json",
294
+ Authorization: `Bearer ${apiKey}`
295
+ },
296
+ body: JSON.stringify({
297
+ model,
298
+ messages: [
299
+ { role: "system", content: systemPrompt },
300
+ {
301
+ role: "user",
302
+ content: `Error Message: ${entry.message}
303
+ Context: ${JSON.stringify(entry.meta)}`
304
+ }
305
+ ],
306
+ max_tokens: 150
307
+ })
308
+ }
309
+ );
310
+ if (!response.ok) return null;
311
+ const data = await response.json();
312
+ return data.choices?.[0]?.message?.content ?? null;
313
+ } catch {
314
+ return null;
315
+ }
316
+ };
317
+ }
318
+
319
+ // src/middleware/alert.ts
320
+ function alertMiddleware(rules) {
321
+ const states = /* @__PURE__ */ new Map();
322
+ for (const rule of rules) {
323
+ states.set(rule.name, { entries: [], lastFired: -Infinity });
324
+ }
325
+ return (entry, next) => {
326
+ const now = entry.timestamp;
327
+ for (const rule of rules) {
328
+ if (!rule.when(entry)) continue;
329
+ const state = states.get(rule.name);
330
+ const windowMs = rule.windowMs ?? Infinity;
331
+ const threshold = rule.threshold ?? 1;
332
+ const cooldownMs = rule.cooldownMs ?? 0;
333
+ if (Number.isFinite(windowMs)) {
334
+ state.entries = state.entries.filter(
335
+ (e) => now - e.timestamp < windowMs
336
+ );
337
+ }
338
+ state.entries.push(entry);
339
+ if (state.entries.length >= threshold && now - state.lastFired >= cooldownMs) {
340
+ const alertEntries = [...state.entries];
341
+ state.entries = [];
342
+ state.lastFired = now;
343
+ try {
344
+ const result = rule.onAlert(alertEntries);
345
+ if (result && typeof result.catch === "function") {
346
+ result.catch(() => {
347
+ });
348
+ }
349
+ } catch {
350
+ }
351
+ }
352
+ }
353
+ next(entry);
354
+ };
355
+ }
356
+
357
+ // src/middleware/correlation-id.ts
358
+ import { createId as createId2 } from "@paralleldrive/cuid2";
359
+ function correlationIdMiddleware(options = {}) {
360
+ const header = options.header ?? "x-correlation-id";
361
+ const generate = options.generator ?? createId2;
362
+ return (entry, next) => {
363
+ if (entry.correlationId) {
364
+ return next(entry);
365
+ }
366
+ const meta = entry.meta;
367
+ let id = meta.correlationId || meta.traceId || meta[header];
368
+ if (!id) {
369
+ id = generate();
370
+ }
371
+ entry.correlationId = id;
372
+ if (!meta.correlationId) {
373
+ entry.meta.correlationId = id;
374
+ }
375
+ next(entry);
376
+ };
377
+ }
378
+
379
+ // src/middleware/create-middleware.ts
380
+ function createMiddleware(fn) {
381
+ return fn;
382
+ }
383
+
384
+ // src/middleware/deduplication.ts
385
+ function deduplicationMiddleware(options = {}) {
386
+ const windowMs = options.windowMs ?? 1e3;
387
+ const keyFn = options.keyFn ?? ((e) => `${e.level}:${e.message}:${e.error?.message ?? ""}`);
388
+ const buffer = /* @__PURE__ */ new Map();
389
+ return (entry, next) => {
390
+ const key = keyFn(entry);
391
+ if (buffer.has(key)) {
392
+ const state = buffer.get(key);
393
+ state.count++;
394
+ return;
395
+ }
396
+ const timer = setTimeout(() => {
397
+ const state = buffer.get(key);
398
+ if (state) {
399
+ buffer.delete(key);
400
+ if (state.count > 1) {
401
+ state.entry.meta = {
402
+ ...state.entry.meta,
403
+ duplicateCount: state.count
404
+ };
405
+ }
406
+ next(state.entry);
407
+ }
408
+ }, windowMs);
409
+ buffer.set(key, {
410
+ entry,
411
+ count: 1,
412
+ timer
413
+ });
414
+ };
415
+ }
416
+
417
+ // src/middleware/heap-usage.ts
418
+ function heapUsageMiddleware(options = {}) {
419
+ const fieldName = options.fieldName ?? "memory";
420
+ return (entry, next) => {
421
+ if (typeof process !== "undefined" && process.memoryUsage) {
422
+ const memory = process.memoryUsage();
423
+ entry.meta = {
424
+ ...entry.meta,
425
+ [fieldName]: {
426
+ rss: memory.rss,
427
+ heapTotal: memory.heapTotal,
428
+ heapUsed: memory.heapUsed
429
+ }
430
+ };
431
+ }
432
+ next(entry);
433
+ };
434
+ }
435
+
436
+ // src/middleware/ip.ts
437
+ function ipMiddleware(options = {}) {
438
+ const targetField = options.fieldName ?? "ip";
439
+ const keysToCheck = options.headerKeys ?? [
440
+ "x-forwarded-for",
441
+ "x-real-ip",
442
+ "req.ip",
443
+ "ip",
444
+ "x-client-ip"
445
+ ];
446
+ return (entry, next) => {
447
+ const meta = entry.meta;
448
+ const headers = meta.headers || {};
449
+ const req = meta.req || {};
450
+ let foundIp;
451
+ for (const key of keysToCheck) {
452
+ if (typeof meta[key] === "string") {
453
+ foundIp = meta[key];
454
+ break;
455
+ }
456
+ if (typeof headers[key] === "string") {
457
+ foundIp = headers[key];
458
+ break;
459
+ }
460
+ if (typeof req[key] === "string") {
461
+ foundIp = req[key];
462
+ break;
463
+ }
464
+ if (key === "req.ip" && typeof req.ip === "string") {
465
+ foundIp = req.ip;
466
+ break;
467
+ }
468
+ }
469
+ if (foundIp) {
470
+ const firstIp = typeof foundIp === "string" ? foundIp.split(",")[0].trim() : String(foundIp);
471
+ entry.meta = {
472
+ ...entry.meta,
473
+ [targetField]: firstIp
474
+ };
475
+ }
476
+ next(entry);
477
+ };
478
+ }
479
+
480
+ // src/middleware/level-override.ts
481
+ function levelOverrideMiddleware(options = {}) {
482
+ const key = options.key ?? "x-log-level";
483
+ const cleanup = options.cleanup ?? true;
484
+ return (entry, next) => {
485
+ const meta = entry.meta;
486
+ const context = entry.context;
487
+ const levelName = meta[key] || context?.[key] || meta.headers?.[key];
488
+ if (levelName && typeof levelName === "string") {
489
+ const upperName = levelName.toUpperCase();
490
+ if (LogLevel[upperName]) {
491
+ entry.level = LogLevel[upperName];
492
+ entry.levelName = upperName;
493
+ if (cleanup) {
494
+ delete meta[key];
495
+ if (meta.headers) {
496
+ delete meta.headers[key];
497
+ }
498
+ }
499
+ }
500
+ }
501
+ next(entry);
502
+ };
503
+ }
504
+
505
+ // src/middleware/ocpp.ts
506
+ function ocppMiddleware(options = {}) {
507
+ const autoPayloadSize = options.autoPayloadSize ?? true;
508
+ const propagateCorrelationId = options.propagateCorrelationId ?? true;
509
+ return (entry, next) => {
510
+ const enriched = { ...entry, meta: { ...entry.meta } };
511
+ if (autoPayloadSize && enriched.meta.payloadSize === void 0 && enriched.meta.action) {
512
+ try {
513
+ enriched.meta.payloadSize = JSON.stringify(enriched.meta).length;
514
+ } catch {
515
+ }
516
+ }
517
+ if (propagateCorrelationId && enriched.meta.correlationId && !enriched.correlationId) {
518
+ enriched.correlationId = enriched.meta.correlationId;
519
+ }
520
+ next(enriched);
521
+ };
522
+ }
523
+
524
+ // src/middleware/redaction.ts
525
+ var DEFAULT_REDACT_VALUE = "[REDACTED]";
526
+ function redactionMiddleware(options) {
527
+ const paths = new Set(options.paths.map((p) => p.toLowerCase()));
528
+ const replacement = options.replacement ?? DEFAULT_REDACT_VALUE;
529
+ const deep = options.deep ?? true;
530
+ function redactObject(obj) {
531
+ const result = {};
532
+ for (const [key, value] of Object.entries(obj)) {
533
+ if (paths.has(key.toLowerCase())) {
534
+ result[key] = replacement;
535
+ } else if (deep && value !== null && typeof value === "object" && !Array.isArray(value)) {
536
+ result[key] = redactObject(value);
537
+ } else {
538
+ result[key] = value;
539
+ }
540
+ }
541
+ return result;
542
+ }
543
+ return (entry, next) => {
544
+ const redacted = { ...entry };
545
+ if (entry.meta && typeof entry.meta === "object") {
546
+ redacted.meta = redactObject(
547
+ entry.meta
548
+ );
549
+ }
550
+ if (entry.context && typeof entry.context === "object") {
551
+ redacted.context = redactObject(entry.context);
552
+ }
553
+ next(redacted);
554
+ };
555
+ }
556
+
557
+ // src/middleware/sampling.ts
558
+ function samplingMiddleware(options = {}) {
559
+ const keyFn = options.keyFn ?? ((entry) => entry.message);
560
+ const maxPerWindow = options.maxPerWindow ?? 100;
561
+ const windowMs = options.windowMs ?? 6e4;
562
+ const sampleRate = options.sampleRate ?? 1;
563
+ const priorityLevel = options.priorityLevel ?? 40;
564
+ const buckets = /* @__PURE__ */ new Map();
565
+ return (entry, next) => {
566
+ if (entry.level >= priorityLevel) {
567
+ return next(entry);
568
+ }
569
+ if (sampleRate < 1 && Math.random() > sampleRate) {
570
+ return;
571
+ }
572
+ const key = keyFn(entry);
573
+ const now = entry.timestamp;
574
+ let bucket = buckets.get(key);
575
+ if (!bucket || now - bucket.windowStart >= windowMs) {
576
+ bucket = { count: 0, windowStart: now };
577
+ buckets.set(key, bucket);
578
+ }
579
+ if (bucket.count < maxPerWindow) {
580
+ bucket.count++;
581
+ next(entry);
582
+ }
583
+ if (buckets.size > 2e3) {
584
+ const expireBefore = now - windowMs * 2;
585
+ for (const [k, b] of buckets) {
586
+ if (b.windowStart < expireBefore) {
587
+ buckets.delete(k);
588
+ }
589
+ }
590
+ }
591
+ };
592
+ }
593
+
594
+ // src/middleware/user-agent.ts
595
+ function userAgentMiddleware(options = {}) {
596
+ const sourceField = options.sourceField;
597
+ const targetField = options.targetField ?? "client";
598
+ return (entry, next) => {
599
+ const meta = entry.meta;
600
+ const context = entry.context;
601
+ const ua = (sourceField ? meta[sourceField] : void 0) || meta.userAgent || meta["user-agent"] || context?.userAgent || context?.["user-agent"];
602
+ if (ua) {
603
+ const info = parseUserAgent(ua);
604
+ entry.meta = {
605
+ ...entry.meta,
606
+ [targetField]: info
607
+ };
608
+ }
609
+ next(entry);
610
+ };
611
+ }
612
+ function parseUserAgent(ua) {
613
+ const browser = /(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i.exec(ua) || [];
614
+ let name = browser[1] ? browser[1].toLowerCase() : "unknown";
615
+ let version = browser[2] || "unknown";
616
+ if (/trident/i.test(name)) {
617
+ name = "ie";
618
+ } else if (name === "chrome") {
619
+ const edge = /edg(e)?\/(\d+)/i.exec(ua);
620
+ if (edge) {
621
+ name = "edge";
622
+ version = edge[2];
623
+ }
624
+ }
625
+ 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(
626
+ ua
627
+ );
628
+ const os = osResult ? osResult[0].toLowerCase() : "desktop";
629
+ return { browser: name, version, os };
630
+ }
631
+
632
+ // src/transports/batch.ts
633
+ function batchTransport(inner, options = {}) {
634
+ const batchSize = options.batchSize ?? 100;
635
+ const flushIntervalMs = options.flushIntervalMs ?? 5e3;
636
+ let buffer = [];
637
+ let flushTimer = null;
638
+ function scheduleFlush() {
639
+ if (flushTimer) return;
640
+ flushTimer = setTimeout(() => {
641
+ flushTimer = null;
642
+ doFlush();
643
+ }, flushIntervalMs);
644
+ }
645
+ function doFlush() {
646
+ if (buffer.length === 0) return;
647
+ const batch = buffer;
648
+ buffer = [];
649
+ for (const entry of batch) {
650
+ try {
651
+ const result = inner.write(entry);
652
+ if (result && typeof result.catch === "function") {
653
+ result.catch(() => {
654
+ });
655
+ }
656
+ } catch {
657
+ }
658
+ }
659
+ }
660
+ return {
661
+ name: `batch(${inner.name})`,
662
+ level: inner.level,
663
+ write(entry) {
664
+ buffer.push(entry);
665
+ if (buffer.length >= batchSize) {
666
+ doFlush();
667
+ } else {
668
+ scheduleFlush();
669
+ }
670
+ },
671
+ async flush() {
672
+ if (flushTimer) {
673
+ clearTimeout(flushTimer);
674
+ flushTimer = null;
675
+ }
676
+ doFlush();
677
+ await inner.flush?.();
678
+ },
679
+ async close() {
680
+ await this.flush?.();
681
+ await inner.close?.();
682
+ }
683
+ };
684
+ }
685
+
686
+ // src/transports/browser-json-stream.ts
687
+ function browserJsonStreamTransport(options) {
688
+ const stream = options.stream;
689
+ const writer = stream.getWriter();
690
+ const serialize = options.serializer ?? ((entry) => `${JSON.stringify(entry)}
691
+ `);
692
+ return {
693
+ name: "browser-stream",
694
+ level: options.level,
695
+ async write(entry) {
696
+ try {
697
+ const data = serialize(entry);
698
+ await writer.ready;
699
+ await writer.write(data);
700
+ } catch (err) {
701
+ console.error("[voltlog] Failed to write to browser stream", err);
702
+ }
703
+ },
704
+ async close() {
705
+ try {
706
+ await writer.close();
707
+ } catch (_err) {
708
+ }
709
+ }
710
+ };
711
+ }
712
+
713
+ // src/transports/console.ts
714
+ function consoleTransport(options = {}) {
715
+ const useConsoleLevels = options.useConsoleLevels ?? true;
716
+ const formatter = options.formatter ?? ((entry) => JSON.stringify(entry));
717
+ return {
718
+ name: "console",
719
+ level: options.level,
720
+ write(entry) {
721
+ const output = formatter(entry);
722
+ if (!useConsoleLevels) {
723
+ console.log(output);
724
+ return;
725
+ }
726
+ if (entry.level >= LogLevel.FATAL) {
727
+ console.error(output);
728
+ } else if (entry.level >= LogLevel.ERROR) {
729
+ console.error(output);
730
+ } else if (entry.level >= LogLevel.WARN) {
731
+ console.warn(output);
732
+ } else if (entry.level >= LogLevel.INFO) {
733
+ console.info(output);
734
+ } else if (entry.level >= LogLevel.DEBUG) {
735
+ console.debug(output);
736
+ } else {
737
+ console.log(output);
738
+ }
739
+ }
740
+ };
741
+ }
742
+
743
+ // src/transports/create-transport.ts
744
+ function createTransport(name, write, options = {}) {
745
+ return {
746
+ name,
747
+ write,
748
+ ...options
749
+ };
750
+ }
751
+
752
+ // src/transports/datadog.ts
753
+ function datadogTransport(options) {
754
+ const {
755
+ apiKey,
756
+ site = "datadoghq.com",
757
+ service,
758
+ ddSource = "nodejs",
759
+ hostname,
760
+ tags,
761
+ level
762
+ } = options;
763
+ const url = `https://http-intake.logs.${site}/api/v2/logs`;
764
+ return {
765
+ name: "datadog",
766
+ level,
767
+ async write(entry) {
768
+ const payload = {
769
+ ddsource: ddSource,
770
+ ddtags: tags,
771
+ hostname,
772
+ service,
773
+ message: entry.message,
774
+ status: entry.levelName.toLowerCase(),
775
+ // Datadog uses lowercase status
776
+ ...entry.meta,
777
+ timestamp: entry.timestamp
778
+ // Datadog auto-parses this
779
+ };
780
+ try {
781
+ await fetch(url, {
782
+ method: "POST",
783
+ headers: {
784
+ "Content-Type": "application/json",
785
+ "DD-API-KEY": apiKey
786
+ },
787
+ body: JSON.stringify(payload)
788
+ });
789
+ } catch (err) {
790
+ console.error("[voltlog] Datadog push failed", err);
791
+ }
792
+ }
793
+ };
794
+ }
795
+
796
+ // src/transports/discord.ts
797
+ function discordTransport(options) {
798
+ const { webhookUrl, username, avatarUrl, level = "ERROR" } = options;
799
+ return {
800
+ name: "discord",
801
+ level,
802
+ async write(entry) {
803
+ try {
804
+ await fetch(webhookUrl, {
805
+ method: "POST",
806
+ headers: { "Content-Type": "application/json" },
807
+ body: JSON.stringify(
808
+ formatDiscordPayload(entry, username, avatarUrl)
809
+ )
810
+ });
811
+ } catch (_err) {
812
+ }
813
+ }
814
+ };
815
+ }
816
+ function formatDiscordPayload(entry, username, avatar_url) {
817
+ const color = getLevelColor(entry.level);
818
+ return {
819
+ username: username || "VoltLog",
820
+ avatar_url,
821
+ embeds: [
822
+ {
823
+ title: `${entry.levelName} - ${entry.message}`,
824
+ color,
825
+ timestamp: new Date(entry.timestamp).toISOString(),
826
+ fields: [
827
+ {
828
+ name: "Meta",
829
+ value: `\`\`\`json
830
+ ${JSON.stringify(entry.meta, null, 2).slice(
831
+ 0,
832
+ 1e3
833
+ )}
834
+ \`\`\``
835
+ },
836
+ entry.error?.stack ? {
837
+ name: "Stack",
838
+ value: `\`\`\`js
839
+ ${entry.error.stack.slice(0, 1e3)}
840
+ \`\`\``
841
+ } : null
842
+ ].filter(Boolean)
843
+ }
844
+ ]
845
+ };
846
+ }
847
+ function getLevelColor(level) {
848
+ if (level >= 50) return 15158332;
849
+ if (level >= 40) return 16776960;
850
+ if (level >= 30) return 3447003;
851
+ return 9807270;
852
+ }
853
+
854
+ // src/transports/file.ts
855
+ import fs from "fs";
856
+ import path from "path";
857
+ function fileTransport(options) {
858
+ const { dir, level } = options;
859
+ const filenamePattern = options.filename ?? "app-%DATE%.log";
860
+ let currentStream = null;
861
+ let currentPath = "";
862
+ try {
863
+ fs.mkdirSync(dir, { recursive: true });
864
+ } catch (err) {
865
+ console.error(`[voltlog] Failed to create log directory: ${dir}`, err);
866
+ }
867
+ function getPath() {
868
+ const now = /* @__PURE__ */ new Date();
869
+ const dateStr = now.toISOString().split("T")[0];
870
+ const filename = filenamePattern.replace("%DATE%", dateStr);
871
+ return path.join(dir, filename);
872
+ }
873
+ function rotate() {
874
+ const newPath = getPath();
875
+ if (newPath !== currentPath) {
876
+ if (currentStream) {
877
+ currentStream.end();
878
+ }
879
+ currentPath = newPath;
880
+ currentStream = fs.createWriteStream(newPath, { flags: "a" });
881
+ currentStream.on("error", (err) => {
882
+ console.error(`[voltlog] File write error to ${newPath}:`, err);
883
+ });
884
+ }
885
+ }
886
+ rotate();
887
+ return {
888
+ name: "file",
889
+ level,
890
+ write(entry) {
891
+ rotate();
892
+ if (currentStream && !currentStream.writableEnded) {
893
+ const line = `${JSON.stringify(entry)}
894
+ `;
895
+ currentStream.write(line);
896
+ }
897
+ },
898
+ async flush() {
899
+ },
900
+ async close() {
901
+ if (currentStream) {
902
+ return new Promise((resolve) => {
903
+ currentStream?.end(() => resolve());
904
+ });
905
+ }
906
+ }
907
+ };
908
+ }
909
+
910
+ // src/transports/json-stream.ts
911
+ function jsonStreamTransport(options) {
912
+ const stream = options.stream;
913
+ const serialize = options.serializer ?? ((entry) => `${JSON.stringify(entry)}
914
+ `);
915
+ return {
916
+ name: "json-stream",
917
+ level: options.level,
918
+ write(entry) {
919
+ const data = serialize(entry);
920
+ stream.write(data);
921
+ },
922
+ close() {
923
+ return new Promise((resolve) => {
924
+ if ("end" in stream && typeof stream.end === "function") {
925
+ stream.end(() => resolve());
926
+ } else {
927
+ resolve();
928
+ }
929
+ });
930
+ }
931
+ };
932
+ }
933
+
934
+ // src/transports/loki.ts
935
+ function lokiTransport(options) {
936
+ const { host, labels = { app: "voltlog" }, level } = options;
937
+ const batchSize = options.batchSize ?? 10;
938
+ const interval = options.interval ?? 5e3;
939
+ const url = `${host.replace(/\/$/, "")}/loki/api/v1/push`;
940
+ const headers = {
941
+ "Content-Type": "application/json"
942
+ };
943
+ if (options.basicAuthUser && options.basicAuthPassword) {
944
+ const creds = btoa(`${options.basicAuthUser}:${options.basicAuthPassword}`);
945
+ headers.Authorization = `Basic ${creds}`;
946
+ }
947
+ if (options.tenantId) {
948
+ headers["X-Scope-OrgID"] = options.tenantId;
949
+ }
950
+ let buffer = [];
951
+ let timer = null;
952
+ const flush = async () => {
953
+ if (buffer.length === 0) return;
954
+ const batch = buffer;
955
+ buffer = [];
956
+ const streams = [
957
+ {
958
+ stream: labels,
959
+ values: batch.map((e) => [
960
+ String(e.timestamp * 1e6),
961
+ // Loki wants nanoseconds
962
+ JSON.stringify({
963
+ level: e.levelName,
964
+ message: e.message,
965
+ ...e.meta
966
+ })
967
+ ])
968
+ }
969
+ ];
970
+ try {
971
+ await fetch(url, {
972
+ method: "POST",
973
+ headers,
974
+ body: JSON.stringify({ streams })
975
+ });
976
+ } catch (err) {
977
+ console.error("[voltlog] Loki push failed", err);
978
+ }
979
+ };
980
+ const schedule = () => {
981
+ if (!timer) {
982
+ timer = setTimeout(() => {
983
+ timer = null;
984
+ flush();
985
+ }, interval);
986
+ }
987
+ };
988
+ return {
989
+ name: "loki",
990
+ level,
991
+ write(entry) {
992
+ buffer.push(entry);
993
+ if (buffer.length >= batchSize) {
994
+ if (timer) clearTimeout(timer);
995
+ timer = null;
996
+ flush();
997
+ } else {
998
+ schedule();
999
+ }
1000
+ },
1001
+ async flush() {
1002
+ if (timer) clearTimeout(timer);
1003
+ await flush();
1004
+ },
1005
+ async close() {
1006
+ await this.flush?.();
1007
+ }
1008
+ };
1009
+ }
1010
+
1011
+ // src/transports/pretty.ts
1012
+ var RESET = "\x1B[0m";
1013
+ var DIM = "\x1B[2m";
1014
+ var BOLD = "\x1B[1m";
1015
+ var COLORS = {
1016
+ TRACE: "\x1B[90m",
1017
+ // gray
1018
+ DEBUG: "\x1B[36m",
1019
+ // cyan
1020
+ INFO: "\x1B[32m",
1021
+ // green
1022
+ WARN: "\x1B[33m",
1023
+ // yellow
1024
+ ERROR: "\x1B[31m",
1025
+ // red
1026
+ FATAL: "\x1B[35;1m"
1027
+ // bold magenta
1028
+ };
1029
+ var ICONS = {
1030
+ TRACE: "\u{1F50D}",
1031
+ DEBUG: "\u{1F41B}",
1032
+ INFO: "\u2139",
1033
+ WARN: "\u26A0",
1034
+ ERROR: "\u2716",
1035
+ FATAL: "\u{1F480}"
1036
+ };
1037
+ var EXCHANGE_ICONS = {
1038
+ CALL: "\u26A1",
1039
+ CALLRESULT: "\u2714",
1040
+ CALLERROR: "\u{1F6A8}"
1041
+ };
1042
+ var DIRECTION_ARROWS = {
1043
+ IN: "\u2192",
1044
+ OUT: "\u2190"
1045
+ };
1046
+ function prettyTransport(options = {}) {
1047
+ const showTimestamps = options.timestamps ?? true;
1048
+ const useColors = options.colors ?? true;
1049
+ function colorize(text, color) {
1050
+ return useColors ? `${color}${text}${RESET}` : text;
1051
+ }
1052
+ function formatExchange(entry) {
1053
+ const meta = entry.meta;
1054
+ if (!meta || !meta.action || !meta.messageType) return null;
1055
+ const icon = EXCHANGE_ICONS[meta.messageType] ?? "\u2022";
1056
+ const arrow = DIRECTION_ARROWS[meta.direction ?? "IN"] ?? "\u2192";
1057
+ const cpId = meta.chargePointId ?? "unknown";
1058
+ const action = meta.action;
1059
+ const msgType = meta.messageType;
1060
+ const dir = meta.direction ?? "";
1061
+ let line = `${icon} ${colorize(cpId, BOLD)} ${arrow} ${colorize(
1062
+ action,
1063
+ BOLD
1064
+ )} [${dir}] ${colorize(msgType, DIM)}`;
1065
+ if (meta.status || meta.latencyMs !== void 0) {
1066
+ const statusIcon = meta.messageType === "CALLERROR" ? "\u274C" : "\u2714";
1067
+ const status = meta.status ?? "";
1068
+ const latency = meta.latencyMs !== void 0 ? `(${meta.latencyMs}ms)` : "";
1069
+ line += `
1070
+ ${statusIcon} ${status} ${colorize(latency, DIM)}`;
1071
+ }
1072
+ return line;
1073
+ }
1074
+ function formatStandard(entry) {
1075
+ const icon = ICONS[entry.levelName] ?? "\u2022";
1076
+ const levelColor = COLORS[entry.levelName] ?? "";
1077
+ const level = colorize(entry.levelName.padEnd(5), levelColor);
1078
+ const ts = showTimestamps ? `${colorize(new Date(entry.timestamp).toISOString(), DIM)} ` : "";
1079
+ let line = `${icon} ${ts}${level} ${entry.message}`;
1080
+ if (entry.context && Object.keys(entry.context).length > 0) {
1081
+ line += ` ${colorize(JSON.stringify(entry.context), DIM)}`;
1082
+ }
1083
+ if (entry.meta && Object.keys(entry.meta).length > 0) {
1084
+ line += ` ${colorize(JSON.stringify(entry.meta), DIM)}`;
1085
+ }
1086
+ if (entry.error) {
1087
+ line += `
1088
+ ${colorize(
1089
+ `${entry.error.name ?? "Error"}: ${entry.error.message}`,
1090
+ COLORS.ERROR ?? ""
1091
+ )}`;
1092
+ if (entry.error.stack) {
1093
+ line += `
1094
+ ${colorize(entry.error.stack, DIM)}`;
1095
+ }
1096
+ }
1097
+ return line;
1098
+ }
1099
+ return {
1100
+ name: "pretty",
1101
+ level: options.level,
1102
+ write(entry) {
1103
+ const exchangeOutput = formatExchange(entry);
1104
+ if (exchangeOutput) {
1105
+ console.log(exchangeOutput);
1106
+ return;
1107
+ }
1108
+ const output = formatStandard(entry);
1109
+ if (entry.level >= LogLevel.ERROR) {
1110
+ console.error(output);
1111
+ } else if (entry.level >= LogLevel.WARN) {
1112
+ console.warn(output);
1113
+ } else {
1114
+ console.log(output);
1115
+ }
1116
+ }
1117
+ };
1118
+ }
1119
+
1120
+ // src/transports/redis.ts
1121
+ function redisTransport(options) {
1122
+ const { client, streamKey = "logs", maxLen, level } = options;
1123
+ const fieldMapper = options.fieldMapper ?? defaultFieldMapper;
1124
+ function defaultFieldMapper(entry) {
1125
+ return {
1126
+ id: entry.id,
1127
+ level: String(entry.level),
1128
+ levelName: entry.levelName,
1129
+ message: entry.message,
1130
+ timestamp: String(entry.timestamp),
1131
+ data: JSON.stringify({
1132
+ meta: entry.meta,
1133
+ context: entry.context,
1134
+ correlationId: entry.correlationId,
1135
+ error: entry.error
1136
+ })
1137
+ };
1138
+ }
1139
+ return {
1140
+ name: "redis",
1141
+ level,
1142
+ write(entry) {
1143
+ const fields = fieldMapper(entry);
1144
+ const args = [streamKey];
1145
+ if (maxLen) {
1146
+ args.push("MAXLEN", "~", maxLen);
1147
+ }
1148
+ args.push("*");
1149
+ for (const [key, value] of Object.entries(fields)) {
1150
+ args.push(key, value);
1151
+ }
1152
+ client.xadd(...args).catch(() => {
1153
+ });
1154
+ },
1155
+ async close() {
1156
+ }
1157
+ };
1158
+ }
1159
+
1160
+ // src/transports/sentry.ts
1161
+ function sentryTransport(options) {
1162
+ const { sentry } = options;
1163
+ const errorLevelValue = resolveLevel(options.errorLevel ?? "ERROR");
1164
+ const breadcrumbLevelValue = resolveLevel(options.breadcrumbLevel ?? "INFO");
1165
+ return {
1166
+ name: "sentry",
1167
+ write(entry) {
1168
+ if (entry.level >= errorLevelValue) {
1169
+ if (entry.error) {
1170
+ sentry.captureException(entry.error, {
1171
+ extra: {
1172
+ ...entry.meta,
1173
+ context: entry.context
1174
+ },
1175
+ level: "error"
1176
+ });
1177
+ } else {
1178
+ sentry.captureMessage(entry.message, "error");
1179
+ }
1180
+ }
1181
+ if (entry.level >= breadcrumbLevelValue) {
1182
+ sentry.addBreadcrumb({
1183
+ category: "log",
1184
+ message: entry.message,
1185
+ level: mapLevelToSentry(entry.level),
1186
+ data: { ...entry.meta, ...entry.context },
1187
+ timestamp: entry.timestamp / 1e3
1188
+ });
1189
+ }
1190
+ }
1191
+ };
1192
+ }
1193
+ function mapLevelToSentry(level) {
1194
+ if (level >= 60) return "fatal";
1195
+ if (level >= 50) return "error";
1196
+ if (level >= 40) return "warning";
1197
+ if (level >= 30) return "info";
1198
+ return "debug";
1199
+ }
1200
+
1201
+ // src/transports/slack.ts
1202
+ function slackTransport(options) {
1203
+ const { webhookUrl, username, iconEmoji, level } = options;
1204
+ return {
1205
+ name: "slack",
1206
+ level: level ?? "ERROR",
1207
+ // Default to ERROR to prevent spamming
1208
+ async write(entry) {
1209
+ try {
1210
+ const payload = formatSlackMessage(entry, username, iconEmoji);
1211
+ const response = await fetch(webhookUrl, {
1212
+ method: "POST",
1213
+ headers: { "Content-Type": "application/json" },
1214
+ body: JSON.stringify(payload)
1215
+ });
1216
+ if (!response.ok) {
1217
+ }
1218
+ } catch (_err) {
1219
+ }
1220
+ }
1221
+ };
1222
+ }
1223
+ function formatSlackMessage(entry, username, icon_emoji) {
1224
+ const levelEmoji = getLevelEmoji(entry.level);
1225
+ const color = getLevelColor2(entry.level);
1226
+ const blocks = [
1227
+ {
1228
+ type: "header",
1229
+ text: {
1230
+ type: "plain_text",
1231
+ text: `${levelEmoji} ${entry.levelName}: ${entry.message}`,
1232
+ emoji: true
1233
+ }
1234
+ },
1235
+ {
1236
+ type: "context",
1237
+ elements: [
1238
+ {
1239
+ type: "mrkdwn",
1240
+ text: `*Time:* ${new Date(entry.timestamp).toISOString()}`
1241
+ },
1242
+ {
1243
+ type: "mrkdwn",
1244
+ text: `*ID:* \`${entry.id}\``
1245
+ }
1246
+ ]
1247
+ }
1248
+ ];
1249
+ if (entry.correlationId) {
1250
+ blocks[1].elements.push({
1251
+ type: "mrkdwn",
1252
+ text: `*Trace:* \`${entry.correlationId}\``
1253
+ });
1254
+ }
1255
+ if (Object.keys(entry.meta).length > 0) {
1256
+ blocks.push({
1257
+ type: "section",
1258
+ text: {
1259
+ type: "mrkdwn",
1260
+ text: `*Metadata:*
1261
+ \`\`\`${JSON.stringify(entry.meta, null, 2)}\`\`\``,
1262
+ emoji: true
1263
+ }
1264
+ });
1265
+ }
1266
+ if (entry.error?.stack) {
1267
+ blocks.push({
1268
+ type: "section",
1269
+ text: {
1270
+ type: "mrkdwn",
1271
+ text: `*Error Stack:*
1272
+ \`\`\`${entry.error.stack}\`\`\``,
1273
+ emoji: true
1274
+ }
1275
+ });
1276
+ }
1277
+ return {
1278
+ username,
1279
+ icon_emoji,
1280
+ attachments: [
1281
+ {
1282
+ color,
1283
+ blocks
1284
+ }
1285
+ ]
1286
+ };
1287
+ }
1288
+ function getLevelEmoji(level) {
1289
+ if (level >= 60) return "\u{1F525}";
1290
+ if (level >= 50) return "\u{1F6A8}";
1291
+ if (level >= 40) return "\u26A0\uFE0F";
1292
+ if (level >= 30) return "\u2139\uFE0F";
1293
+ if (level >= 20) return "\u{1F41B}";
1294
+ return "\u{1F50D}";
1295
+ }
1296
+ function getLevelColor2(level) {
1297
+ if (level >= 60) return "#ff0000";
1298
+ if (level >= 50) return "#ff4444";
1299
+ if (level >= 40) return "#ffbb33";
1300
+ if (level >= 30) return "#33b5e5";
1301
+ if (level >= 20) return "#99cc00";
1302
+ return "#aa66cc";
1303
+ }
1304
+
1305
+ // src/transports/webhook.ts
1306
+ function webhookTransport(options) {
1307
+ const {
1308
+ url,
1309
+ method = "POST",
1310
+ headers = {},
1311
+ batchSize = 1,
1312
+ flushIntervalMs = 5e3,
1313
+ retry = false,
1314
+ maxRetries = 3
1315
+ } = options;
1316
+ const serialize = options.serializer ?? ((entries) => JSON.stringify({
1317
+ entries,
1318
+ count: entries.length,
1319
+ timestamp: Date.now()
1320
+ }));
1321
+ let buffer = [];
1322
+ let flushTimer = null;
1323
+ async function sendBatch(entries, attempt = 0) {
1324
+ try {
1325
+ const response = await fetch(url, {
1326
+ method,
1327
+ headers: {
1328
+ "Content-Type": "application/json",
1329
+ ...headers
1330
+ },
1331
+ body: serialize(entries)
1332
+ });
1333
+ if (!response.ok && retry && attempt < maxRetries) {
1334
+ const delay = Math.min(1e3 * 2 ** attempt, 3e4);
1335
+ await new Promise((r) => setTimeout(r, delay));
1336
+ return sendBatch(entries, attempt + 1);
1337
+ }
1338
+ } catch {
1339
+ if (retry && attempt < maxRetries) {
1340
+ const delay = Math.min(1e3 * 2 ** attempt, 3e4);
1341
+ await new Promise((r) => setTimeout(r, delay));
1342
+ return sendBatch(entries, attempt + 1);
1343
+ }
1344
+ }
1345
+ }
1346
+ function scheduleFlush() {
1347
+ if (flushTimer) return;
1348
+ flushTimer = setTimeout(() => {
1349
+ flushTimer = null;
1350
+ doFlush();
1351
+ }, flushIntervalMs);
1352
+ }
1353
+ function doFlush() {
1354
+ if (buffer.length === 0) return;
1355
+ const batch = buffer;
1356
+ buffer = [];
1357
+ sendBatch(batch).catch(() => {
1358
+ });
1359
+ }
1360
+ return {
1361
+ name: "webhook",
1362
+ level: options.level,
1363
+ write(entry) {
1364
+ buffer.push(entry);
1365
+ if (buffer.length >= batchSize) {
1366
+ doFlush();
1367
+ } else {
1368
+ scheduleFlush();
1369
+ }
1370
+ },
1371
+ async flush() {
1372
+ if (flushTimer) {
1373
+ clearTimeout(flushTimer);
1374
+ flushTimer = null;
1375
+ }
1376
+ if (buffer.length > 0) {
1377
+ const batch = buffer;
1378
+ buffer = [];
1379
+ await sendBatch(batch);
1380
+ }
1381
+ },
1382
+ async close() {
1383
+ await this.flush?.();
1384
+ }
1385
+ };
1386
+ }
1387
+ export {
1388
+ LogLevel,
1389
+ LogLevelNameMap,
1390
+ LogLevelValueMap,
1391
+ aiEnrichmentMiddleware,
1392
+ alertMiddleware,
1393
+ batchTransport,
1394
+ browserJsonStreamTransport,
1395
+ consoleTransport,
1396
+ correlationIdMiddleware,
1397
+ createLogger,
1398
+ createMiddleware,
1399
+ createOpenAiErrorAnalyzer,
1400
+ createTransport,
1401
+ datadogTransport,
1402
+ deduplicationMiddleware,
1403
+ discordTransport,
1404
+ fileTransport,
1405
+ heapUsageMiddleware,
1406
+ ipMiddleware,
1407
+ jsonStreamTransport,
1408
+ levelOverrideMiddleware,
1409
+ lokiTransport,
1410
+ ocppMiddleware,
1411
+ prettyTransport,
1412
+ redactionMiddleware,
1413
+ redisTransport,
1414
+ resolveLevel,
1415
+ samplingMiddleware,
1416
+ sentryTransport,
1417
+ shouldIncludeStack,
1418
+ shouldLog,
1419
+ slackTransport,
1420
+ userAgentMiddleware,
1421
+ webhookTransport
1422
+ };
1423
+ //# sourceMappingURL=index.mjs.map