voltlog-io 1.0.7 → 1.0.8
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/browser/client.d.mts +1 -56
- package/dist/browser/client.d.ts +1 -56
- package/dist/browser/client.js +21 -62
- package/dist/browser/client.mjs +0 -41
- package/package.json +1 -1
|
@@ -591,61 +591,6 @@ interface OcppMiddlewareOptions {
|
|
|
591
591
|
*/
|
|
592
592
|
declare function ocppMiddleware(options?: OcppMiddlewareOptions): LogMiddleware<OcppExchangeMeta>;
|
|
593
593
|
|
|
594
|
-
/**
|
|
595
|
-
* @module voltlog-io
|
|
596
|
-
* @description OpenTelemetry middleware — automatically picks up the active trace context.
|
|
597
|
-
* Works like Winston's @opentelemetry/instrumentation-winston but as a simple middleware.
|
|
598
|
-
*
|
|
599
|
-
* @server-only Requires `@opentelemetry/api` as an optional peer dependency.
|
|
600
|
-
*
|
|
601
|
-
* When the OpenTelemetry SDK is active (e.g., with SigNoz, Jaeger, Grafana Tempo),
|
|
602
|
-
* this middleware automatically injects traceId, spanId, and traceFlags into every log entry.
|
|
603
|
-
*
|
|
604
|
-
* @example
|
|
605
|
-
* ```ts
|
|
606
|
-
* import { createLogger, otelTraceMiddleware, otelTransport } from 'voltlog-io';
|
|
607
|
-
*
|
|
608
|
-
* const logger = createLogger({
|
|
609
|
-
* middleware: [otelTraceMiddleware()],
|
|
610
|
-
* transports: [
|
|
611
|
-
* otelTransport({
|
|
612
|
-
* endpoint: 'http://localhost:4318',
|
|
613
|
-
* serviceName: 'my-app',
|
|
614
|
-
* }),
|
|
615
|
-
* ],
|
|
616
|
-
* });
|
|
617
|
-
*
|
|
618
|
-
* // If an OTel span is active, every log automatically gets:
|
|
619
|
-
* // { traceId: "abc123...", spanId: "def456...", traceFlags: 1 }
|
|
620
|
-
* logger.info("Processing request");
|
|
621
|
-
* ```
|
|
622
|
-
*/
|
|
623
|
-
|
|
624
|
-
interface OtelTraceMiddlewareOptions {
|
|
625
|
-
/**
|
|
626
|
-
* Custom reference to `@opentelemetry/api` trace module.
|
|
627
|
-
* If not provided, we attempt `require('@opentelemetry/api')` or dynamic import.
|
|
628
|
-
* This allows the middleware to work without a hard dependency.
|
|
629
|
-
*/
|
|
630
|
-
traceApi?: {
|
|
631
|
-
trace: {
|
|
632
|
-
getActiveSpan: () => unknown;
|
|
633
|
-
};
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
/**
|
|
637
|
-
* Middleware that automatically injects OpenTelemetry trace context into log entries.
|
|
638
|
-
*
|
|
639
|
-
* How it works:
|
|
640
|
-
* 1. On each log call, checks for an active OTel span
|
|
641
|
-
* 2. If found, extracts traceId, spanId, and traceFlags
|
|
642
|
-
* 3. Injects them into the log entry's metadata
|
|
643
|
-
*
|
|
644
|
-
* This is the equivalent of Winston's @opentelemetry/instrumentation-winston
|
|
645
|
-
* but implemented as a zero-dependency middleware.
|
|
646
|
-
*/
|
|
647
|
-
declare function otelTraceMiddleware<TMeta = Record<string, unknown>>(options?: OtelTraceMiddlewareOptions): LogMiddleware<TMeta>;
|
|
648
|
-
|
|
649
594
|
/**
|
|
650
595
|
* @module voltlog-io
|
|
651
596
|
* @description Redaction middleware — masks sensitive data in log entries.
|
|
@@ -1236,4 +1181,4 @@ interface WebhookTransportOptions {
|
|
|
1236
1181
|
*/
|
|
1237
1182
|
declare function webhookTransport(options: WebhookTransportOptions): Transport;
|
|
1238
1183
|
|
|
1239
|
-
export { type AiEnrichmentOptions, type AlertRule, type BatchTransportOptions, type BrowserJsonStreamTransportOptions, type ConsoleTransportOptions, type DatadogTransportOptions, type DeduplicationOptions, type DiscordTransportOptions, type HttpLoggerOptions, type HttpRequestMapper, type HttpResponseMapper, type LevelOverrideOptions, type LogEntry, type LogError, LogLevel, type LogLevelName, LogLevelNameMap, type LogLevelValue, LogLevelValueMap, type LogMiddleware, type Logger, type LoggerOptions, type LokiTransportOptions, type OcppExchangeMeta, type OcppMiddlewareOptions, type
|
|
1184
|
+
export { type AiEnrichmentOptions, type AlertRule, type BatchTransportOptions, type BrowserJsonStreamTransportOptions, type ConsoleTransportOptions, type DatadogTransportOptions, type DeduplicationOptions, type DiscordTransportOptions, type HttpLoggerOptions, type HttpRequestMapper, type HttpResponseMapper, type LevelOverrideOptions, type LogEntry, type LogError, LogLevel, type LogLevelName, LogLevelNameMap, type LogLevelValue, LogLevelValueMap, type LogMiddleware, type Logger, type LoggerOptions, type LokiTransportOptions, type OcppExchangeMeta, type OcppMiddlewareOptions, type OtelTransportOptions, type PrettyTransportOptions, type RedactionOptions, type RingBufferQueryOptions, type RingBufferTransport, type RingBufferTransportOptions, type SamplingOptions, type SentryInstance, type SentryTransportOptions, type SlackTransportOptions, type TimerResult, type Transport, type UserAgentOptions, type WebhookTransportOptions, aiEnrichmentMiddleware, alertMiddleware, batchTransport, browserJsonStreamTransport, consoleTransport, createHttpLogger, createLogger, createMiddleware, createOpenAiErrorAnalyzer, createTransport, datadogTransport, deduplicationMiddleware, discordTransport, heapUsageMiddleware, ipMiddleware, levelOverrideMiddleware, lokiTransport, ocppMiddleware, otelTransport, prettyTransport, redactionMiddleware, resolveLevel, ringBufferTransport, samplingMiddleware, sentryTransport, shouldIncludeStack, shouldLog, slackTransport, userAgentMiddleware, webhookTransport };
|
package/dist/browser/client.d.ts
CHANGED
|
@@ -591,61 +591,6 @@ interface OcppMiddlewareOptions {
|
|
|
591
591
|
*/
|
|
592
592
|
declare function ocppMiddleware(options?: OcppMiddlewareOptions): LogMiddleware<OcppExchangeMeta>;
|
|
593
593
|
|
|
594
|
-
/**
|
|
595
|
-
* @module voltlog-io
|
|
596
|
-
* @description OpenTelemetry middleware — automatically picks up the active trace context.
|
|
597
|
-
* Works like Winston's @opentelemetry/instrumentation-winston but as a simple middleware.
|
|
598
|
-
*
|
|
599
|
-
* @server-only Requires `@opentelemetry/api` as an optional peer dependency.
|
|
600
|
-
*
|
|
601
|
-
* When the OpenTelemetry SDK is active (e.g., with SigNoz, Jaeger, Grafana Tempo),
|
|
602
|
-
* this middleware automatically injects traceId, spanId, and traceFlags into every log entry.
|
|
603
|
-
*
|
|
604
|
-
* @example
|
|
605
|
-
* ```ts
|
|
606
|
-
* import { createLogger, otelTraceMiddleware, otelTransport } from 'voltlog-io';
|
|
607
|
-
*
|
|
608
|
-
* const logger = createLogger({
|
|
609
|
-
* middleware: [otelTraceMiddleware()],
|
|
610
|
-
* transports: [
|
|
611
|
-
* otelTransport({
|
|
612
|
-
* endpoint: 'http://localhost:4318',
|
|
613
|
-
* serviceName: 'my-app',
|
|
614
|
-
* }),
|
|
615
|
-
* ],
|
|
616
|
-
* });
|
|
617
|
-
*
|
|
618
|
-
* // If an OTel span is active, every log automatically gets:
|
|
619
|
-
* // { traceId: "abc123...", spanId: "def456...", traceFlags: 1 }
|
|
620
|
-
* logger.info("Processing request");
|
|
621
|
-
* ```
|
|
622
|
-
*/
|
|
623
|
-
|
|
624
|
-
interface OtelTraceMiddlewareOptions {
|
|
625
|
-
/**
|
|
626
|
-
* Custom reference to `@opentelemetry/api` trace module.
|
|
627
|
-
* If not provided, we attempt `require('@opentelemetry/api')` or dynamic import.
|
|
628
|
-
* This allows the middleware to work without a hard dependency.
|
|
629
|
-
*/
|
|
630
|
-
traceApi?: {
|
|
631
|
-
trace: {
|
|
632
|
-
getActiveSpan: () => unknown;
|
|
633
|
-
};
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
/**
|
|
637
|
-
* Middleware that automatically injects OpenTelemetry trace context into log entries.
|
|
638
|
-
*
|
|
639
|
-
* How it works:
|
|
640
|
-
* 1. On each log call, checks for an active OTel span
|
|
641
|
-
* 2. If found, extracts traceId, spanId, and traceFlags
|
|
642
|
-
* 3. Injects them into the log entry's metadata
|
|
643
|
-
*
|
|
644
|
-
* This is the equivalent of Winston's @opentelemetry/instrumentation-winston
|
|
645
|
-
* but implemented as a zero-dependency middleware.
|
|
646
|
-
*/
|
|
647
|
-
declare function otelTraceMiddleware<TMeta = Record<string, unknown>>(options?: OtelTraceMiddlewareOptions): LogMiddleware<TMeta>;
|
|
648
|
-
|
|
649
594
|
/**
|
|
650
595
|
* @module voltlog-io
|
|
651
596
|
* @description Redaction middleware — masks sensitive data in log entries.
|
|
@@ -1236,4 +1181,4 @@ interface WebhookTransportOptions {
|
|
|
1236
1181
|
*/
|
|
1237
1182
|
declare function webhookTransport(options: WebhookTransportOptions): Transport;
|
|
1238
1183
|
|
|
1239
|
-
export { type AiEnrichmentOptions, type AlertRule, type BatchTransportOptions, type BrowserJsonStreamTransportOptions, type ConsoleTransportOptions, type DatadogTransportOptions, type DeduplicationOptions, type DiscordTransportOptions, type HttpLoggerOptions, type HttpRequestMapper, type HttpResponseMapper, type LevelOverrideOptions, type LogEntry, type LogError, LogLevel, type LogLevelName, LogLevelNameMap, type LogLevelValue, LogLevelValueMap, type LogMiddleware, type Logger, type LoggerOptions, type LokiTransportOptions, type OcppExchangeMeta, type OcppMiddlewareOptions, type
|
|
1184
|
+
export { type AiEnrichmentOptions, type AlertRule, type BatchTransportOptions, type BrowserJsonStreamTransportOptions, type ConsoleTransportOptions, type DatadogTransportOptions, type DeduplicationOptions, type DiscordTransportOptions, type HttpLoggerOptions, type HttpRequestMapper, type HttpResponseMapper, type LevelOverrideOptions, type LogEntry, type LogError, LogLevel, type LogLevelName, LogLevelNameMap, type LogLevelValue, LogLevelValueMap, type LogMiddleware, type Logger, type LoggerOptions, type LokiTransportOptions, type OcppExchangeMeta, type OcppMiddlewareOptions, type OtelTransportOptions, type PrettyTransportOptions, type RedactionOptions, type RingBufferQueryOptions, type RingBufferTransport, type RingBufferTransportOptions, type SamplingOptions, type SentryInstance, type SentryTransportOptions, type SlackTransportOptions, type TimerResult, type Transport, type UserAgentOptions, type WebhookTransportOptions, aiEnrichmentMiddleware, alertMiddleware, batchTransport, browserJsonStreamTransport, consoleTransport, createHttpLogger, createLogger, createMiddleware, createOpenAiErrorAnalyzer, createTransport, datadogTransport, deduplicationMiddleware, discordTransport, heapUsageMiddleware, ipMiddleware, levelOverrideMiddleware, lokiTransport, ocppMiddleware, otelTransport, prettyTransport, redactionMiddleware, resolveLevel, ringBufferTransport, samplingMiddleware, sentryTransport, shouldIncludeStack, shouldLog, slackTransport, userAgentMiddleware, webhookTransport };
|
package/dist/browser/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }// src/core/types.ts
|
|
2
2
|
var LogLevel = {
|
|
3
3
|
TRACE: 10,
|
|
4
4
|
DEBUG: 20,
|
|
@@ -604,46 +604,6 @@ function ocppMiddleware(options = {}) {
|
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
606
|
|
|
607
|
-
// src/middleware/otel-trace.ts
|
|
608
|
-
function otelTraceMiddleware(options = {}) {
|
|
609
|
-
let traceApi = _nullishCoalesce(options.traceApi, () => ( null));
|
|
610
|
-
let resolved = !!traceApi;
|
|
611
|
-
let resolvePromise = null;
|
|
612
|
-
function ensureResolved() {
|
|
613
|
-
if (resolved || resolvePromise) return _nullishCoalesce(resolvePromise, () => ( Promise.resolve()));
|
|
614
|
-
resolvePromise = Promise.resolve().then(() => _interopRequireWildcard(require("@opentelemetry/api"))).then((api) => {
|
|
615
|
-
traceApi = api;
|
|
616
|
-
resolved = true;
|
|
617
|
-
}).catch(() => {
|
|
618
|
-
resolved = true;
|
|
619
|
-
});
|
|
620
|
-
return resolvePromise;
|
|
621
|
-
}
|
|
622
|
-
return (entry, next) => {
|
|
623
|
-
ensureResolved().catch(() => {
|
|
624
|
-
});
|
|
625
|
-
if (resolved && _optionalChain([traceApi, 'optionalAccess', _18 => _18.trace])) {
|
|
626
|
-
try {
|
|
627
|
-
const activeSpan = _optionalChain([traceApi, 'access', _19 => _19.trace, 'access', _20 => _20.getActiveSpan, 'optionalCall', _21 => _21()]);
|
|
628
|
-
if (activeSpan) {
|
|
629
|
-
const spanContext = _optionalChain([activeSpan, 'access', _22 => _22.spanContext, 'optionalCall', _23 => _23()]);
|
|
630
|
-
if (spanContext) {
|
|
631
|
-
const meta = entry.meta;
|
|
632
|
-
meta.traceId = spanContext.traceId;
|
|
633
|
-
meta.spanId = spanContext.spanId;
|
|
634
|
-
meta.traceFlags = spanContext.traceFlags;
|
|
635
|
-
if (!entry.correlationId) {
|
|
636
|
-
entry.correlationId = spanContext.traceId;
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
} catch (e6) {
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
next(entry);
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
|
|
647
607
|
// src/middleware/redaction.ts
|
|
648
608
|
var DEFAULT_REDACT_VALUE = "[REDACTED]";
|
|
649
609
|
function redactionMiddleware(options) {
|
|
@@ -721,7 +681,7 @@ function userAgentMiddleware(options = {}) {
|
|
|
721
681
|
return (entry, next) => {
|
|
722
682
|
const meta = entry.meta;
|
|
723
683
|
const context = entry.context;
|
|
724
|
-
const ua = (sourceField ? meta[sourceField] : void 0) || meta.userAgent || meta["user-agent"] || _optionalChain([context, 'optionalAccess',
|
|
684
|
+
const ua = (sourceField ? meta[sourceField] : void 0) || meta.userAgent || meta["user-agent"] || _optionalChain([context, 'optionalAccess', _18 => _18.userAgent]) || _optionalChain([context, 'optionalAccess', _19 => _19["user-agent"]]);
|
|
725
685
|
if (ua) {
|
|
726
686
|
const info = parseUserAgent(ua);
|
|
727
687
|
entry.meta = {
|
|
@@ -776,7 +736,7 @@ function batchTransport(inner, options = {}) {
|
|
|
776
736
|
result.catch(() => {
|
|
777
737
|
});
|
|
778
738
|
}
|
|
779
|
-
} catch (
|
|
739
|
+
} catch (e6) {
|
|
780
740
|
}
|
|
781
741
|
}
|
|
782
742
|
}
|
|
@@ -797,11 +757,11 @@ function batchTransport(inner, options = {}) {
|
|
|
797
757
|
flushTimer = null;
|
|
798
758
|
}
|
|
799
759
|
doFlush();
|
|
800
|
-
await _optionalChain([inner, 'access',
|
|
760
|
+
await _optionalChain([inner, 'access', _20 => _20.flush, 'optionalCall', _21 => _21()]);
|
|
801
761
|
},
|
|
802
762
|
async close() {
|
|
803
|
-
await _optionalChain([this, 'access',
|
|
804
|
-
await _optionalChain([inner, 'access',
|
|
763
|
+
await _optionalChain([this, 'access', _22 => _22.flush, 'optionalCall', _23 => _23()]);
|
|
764
|
+
await _optionalChain([inner, 'access', _24 => _24.close, 'optionalCall', _25 => _25()]);
|
|
805
765
|
}
|
|
806
766
|
};
|
|
807
767
|
}
|
|
@@ -956,7 +916,7 @@ ${JSON.stringify(entry.meta, null, 2).slice(
|
|
|
956
916
|
)}
|
|
957
917
|
\`\`\``
|
|
958
918
|
},
|
|
959
|
-
_optionalChain([entry, 'access',
|
|
919
|
+
_optionalChain([entry, 'access', _26 => _26.error, 'optionalAccess', _27 => _27.stack]) ? {
|
|
960
920
|
name: "Stack",
|
|
961
921
|
value: `\`\`\`js
|
|
962
922
|
${entry.error.stack.slice(0, 1e3)}
|
|
@@ -1105,7 +1065,7 @@ function lokiTransport(options) {
|
|
|
1105
1065
|
await doFlush();
|
|
1106
1066
|
},
|
|
1107
1067
|
async close() {
|
|
1108
|
-
await _optionalChain([this, 'access',
|
|
1068
|
+
await _optionalChain([this, 'access', _28 => _28.flush, 'optionalCall', _29 => _29()]);
|
|
1109
1069
|
}
|
|
1110
1070
|
};
|
|
1111
1071
|
}
|
|
@@ -1183,19 +1143,19 @@ function otelTransport(options) {
|
|
|
1183
1143
|
const record = {
|
|
1184
1144
|
timeUnixNano: String(entry.timestamp * 1e6),
|
|
1185
1145
|
// ms → ns
|
|
1186
|
-
severityNumber: _optionalChain([severity, 'optionalAccess',
|
|
1187
|
-
severityText: _optionalChain([severity, 'optionalAccess',
|
|
1146
|
+
severityNumber: _optionalChain([severity, 'optionalAccess', _30 => _30.number]),
|
|
1147
|
+
severityText: _optionalChain([severity, 'optionalAccess', _31 => _31.text]),
|
|
1188
1148
|
body: { stringValue: entry.message },
|
|
1189
1149
|
attributes
|
|
1190
1150
|
};
|
|
1191
1151
|
const meta = entry.meta;
|
|
1192
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
1152
|
+
if (_optionalChain([meta, 'optionalAccess', _32 => _32.traceId])) {
|
|
1193
1153
|
record.traceId = meta.traceId;
|
|
1194
1154
|
}
|
|
1195
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
1155
|
+
if (_optionalChain([meta, 'optionalAccess', _33 => _33.spanId])) {
|
|
1196
1156
|
record.spanId = meta.spanId;
|
|
1197
1157
|
}
|
|
1198
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
1158
|
+
if (_optionalChain([meta, 'optionalAccess', _34 => _34.traceFlags]) !== void 0) {
|
|
1199
1159
|
record.flags = meta.traceFlags;
|
|
1200
1160
|
}
|
|
1201
1161
|
return record;
|
|
@@ -1266,7 +1226,7 @@ function otelTransport(options) {
|
|
|
1266
1226
|
await sendBatch(batch);
|
|
1267
1227
|
},
|
|
1268
1228
|
async close() {
|
|
1269
|
-
await _optionalChain([this, 'access',
|
|
1229
|
+
await _optionalChain([this, 'access', _35 => _35.flush, 'optionalCall', _36 => _36()]);
|
|
1270
1230
|
}
|
|
1271
1231
|
};
|
|
1272
1232
|
}
|
|
@@ -1424,15 +1384,15 @@ function ringBufferTransport(options = {}) {
|
|
|
1424
1384
|
} else {
|
|
1425
1385
|
entries = [...buffer.slice(head), ...buffer.slice(0, head)];
|
|
1426
1386
|
}
|
|
1427
|
-
if (_optionalChain([query, 'optionalAccess',
|
|
1387
|
+
if (_optionalChain([query, 'optionalAccess', _37 => _37.level])) {
|
|
1428
1388
|
const minLevel = resolveLevel(query.level);
|
|
1429
1389
|
entries = entries.filter((e) => e.level >= minLevel);
|
|
1430
1390
|
}
|
|
1431
|
-
if (_optionalChain([query, 'optionalAccess',
|
|
1391
|
+
if (_optionalChain([query, 'optionalAccess', _38 => _38.since])) {
|
|
1432
1392
|
const since = query.since;
|
|
1433
1393
|
entries = entries.filter((e) => e.timestamp >= since);
|
|
1434
1394
|
}
|
|
1435
|
-
if (_optionalChain([query, 'optionalAccess',
|
|
1395
|
+
if (_optionalChain([query, 'optionalAccess', _39 => _39.limit])) {
|
|
1436
1396
|
entries = entries.slice(-query.limit);
|
|
1437
1397
|
}
|
|
1438
1398
|
return entries;
|
|
@@ -1554,7 +1514,7 @@ function formatSlackMessage(entry, username, icon_emoji) {
|
|
|
1554
1514
|
}
|
|
1555
1515
|
});
|
|
1556
1516
|
}
|
|
1557
|
-
if (_optionalChain([entry, 'access',
|
|
1517
|
+
if (_optionalChain([entry, 'access', _40 => _40.error, 'optionalAccess', _41 => _41.stack])) {
|
|
1558
1518
|
blocks.push({
|
|
1559
1519
|
type: "section",
|
|
1560
1520
|
text: {
|
|
@@ -1626,7 +1586,7 @@ function webhookTransport(options) {
|
|
|
1626
1586
|
await new Promise((r) => setTimeout(r, delay));
|
|
1627
1587
|
return sendBatch(entries, attempt + 1);
|
|
1628
1588
|
}
|
|
1629
|
-
} catch (
|
|
1589
|
+
} catch (e7) {
|
|
1630
1590
|
if (retry && attempt < maxRetries) {
|
|
1631
1591
|
const delay = Math.min(1e3 * 2 ** attempt, 3e4);
|
|
1632
1592
|
await new Promise((r) => setTimeout(r, delay));
|
|
@@ -1671,7 +1631,7 @@ function webhookTransport(options) {
|
|
|
1671
1631
|
}
|
|
1672
1632
|
},
|
|
1673
1633
|
async close() {
|
|
1674
|
-
await _optionalChain([this, 'access',
|
|
1634
|
+
await _optionalChain([this, 'access', _42 => _42.flush, 'optionalCall', _43 => _43()]);
|
|
1675
1635
|
}
|
|
1676
1636
|
};
|
|
1677
1637
|
}
|
|
@@ -1709,5 +1669,4 @@ function webhookTransport(options) {
|
|
|
1709
1669
|
|
|
1710
1670
|
|
|
1711
1671
|
|
|
1712
|
-
|
|
1713
|
-
exports.LogLevel = LogLevel; exports.LogLevelNameMap = LogLevelNameMap; exports.LogLevelValueMap = LogLevelValueMap; exports.aiEnrichmentMiddleware = aiEnrichmentMiddleware; exports.alertMiddleware = alertMiddleware; exports.batchTransport = batchTransport; exports.browserJsonStreamTransport = browserJsonStreamTransport; exports.consoleTransport = consoleTransport; 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.heapUsageMiddleware = heapUsageMiddleware; exports.ipMiddleware = ipMiddleware; exports.levelOverrideMiddleware = levelOverrideMiddleware; exports.lokiTransport = lokiTransport; exports.ocppMiddleware = ocppMiddleware; exports.otelTraceMiddleware = otelTraceMiddleware; exports.otelTransport = otelTransport; exports.prettyTransport = prettyTransport; exports.redactionMiddleware = redactionMiddleware; 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;
|
|
1672
|
+
exports.LogLevel = LogLevel; exports.LogLevelNameMap = LogLevelNameMap; exports.LogLevelValueMap = LogLevelValueMap; exports.aiEnrichmentMiddleware = aiEnrichmentMiddleware; exports.alertMiddleware = alertMiddleware; exports.batchTransport = batchTransport; exports.browserJsonStreamTransport = browserJsonStreamTransport; exports.consoleTransport = consoleTransport; 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.heapUsageMiddleware = heapUsageMiddleware; exports.ipMiddleware = ipMiddleware; exports.levelOverrideMiddleware = levelOverrideMiddleware; exports.lokiTransport = lokiTransport; exports.ocppMiddleware = ocppMiddleware; exports.otelTransport = otelTransport; exports.prettyTransport = prettyTransport; exports.redactionMiddleware = redactionMiddleware; 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;
|
package/dist/browser/client.mjs
CHANGED
|
@@ -604,46 +604,6 @@ function ocppMiddleware(options = {}) {
|
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
606
|
|
|
607
|
-
// src/middleware/otel-trace.ts
|
|
608
|
-
function otelTraceMiddleware(options = {}) {
|
|
609
|
-
let traceApi = options.traceApi ?? null;
|
|
610
|
-
let resolved = !!traceApi;
|
|
611
|
-
let resolvePromise = null;
|
|
612
|
-
function ensureResolved() {
|
|
613
|
-
if (resolved || resolvePromise) return resolvePromise ?? Promise.resolve();
|
|
614
|
-
resolvePromise = import("@opentelemetry/api").then((api) => {
|
|
615
|
-
traceApi = api;
|
|
616
|
-
resolved = true;
|
|
617
|
-
}).catch(() => {
|
|
618
|
-
resolved = true;
|
|
619
|
-
});
|
|
620
|
-
return resolvePromise;
|
|
621
|
-
}
|
|
622
|
-
return (entry, next) => {
|
|
623
|
-
ensureResolved().catch(() => {
|
|
624
|
-
});
|
|
625
|
-
if (resolved && traceApi?.trace) {
|
|
626
|
-
try {
|
|
627
|
-
const activeSpan = traceApi.trace.getActiveSpan?.();
|
|
628
|
-
if (activeSpan) {
|
|
629
|
-
const spanContext = activeSpan.spanContext?.();
|
|
630
|
-
if (spanContext) {
|
|
631
|
-
const meta = entry.meta;
|
|
632
|
-
meta.traceId = spanContext.traceId;
|
|
633
|
-
meta.spanId = spanContext.spanId;
|
|
634
|
-
meta.traceFlags = spanContext.traceFlags;
|
|
635
|
-
if (!entry.correlationId) {
|
|
636
|
-
entry.correlationId = spanContext.traceId;
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
} catch {
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
next(entry);
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
|
|
647
607
|
// src/middleware/redaction.ts
|
|
648
608
|
var DEFAULT_REDACT_VALUE = "[REDACTED]";
|
|
649
609
|
function redactionMiddleware(options) {
|
|
@@ -1697,7 +1657,6 @@ export {
|
|
|
1697
1657
|
levelOverrideMiddleware,
|
|
1698
1658
|
lokiTransport,
|
|
1699
1659
|
ocppMiddleware,
|
|
1700
|
-
otelTraceMiddleware,
|
|
1701
1660
|
otelTransport,
|
|
1702
1661
|
prettyTransport,
|
|
1703
1662
|
redactionMiddleware,
|
package/package.json
CHANGED