voltlog-io 1.0.6 → 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/{client.d.mts → browser/client.d.mts} +1 -64
- package/dist/{client.d.ts → browser/client.d.ts} +1 -64
- package/dist/{client.js → browser/client.js} +139 -221
- package/dist/{client.mjs → browser/client.mjs} +0 -66
- package/dist/index.d.mts +1 -27
- package/dist/index.d.ts +1 -27
- package/dist/index.js +18 -50
- package/dist/index.mjs +16 -54
- package/package.json +7 -6
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -476,14 +476,6 @@ interface HttpLoggerOptions<TReq = any, TRes = any> {
|
|
|
476
476
|
/** Function to skip logging certain requests (e.g., /health) */
|
|
477
477
|
skip?: (req: TReq) => boolean;
|
|
478
478
|
}
|
|
479
|
-
/**
|
|
480
|
-
* Common mappers for the raw Node.js `http.IncomingMessage` and `http.ServerResponse`.
|
|
481
|
-
* Since Express and many others extend these objects, they work universally.
|
|
482
|
-
*/
|
|
483
|
-
declare const nodeHttpMappers: {
|
|
484
|
-
req: HttpRequestMapper;
|
|
485
|
-
res: HttpResponseMapper;
|
|
486
|
-
};
|
|
487
479
|
/**
|
|
488
480
|
* Creates a generic HTTP logging middleware function.
|
|
489
481
|
* Use this inside Express, Fastify, or custom routers.
|
|
@@ -599,61 +591,6 @@ interface OcppMiddlewareOptions {
|
|
|
599
591
|
*/
|
|
600
592
|
declare function ocppMiddleware(options?: OcppMiddlewareOptions): LogMiddleware<OcppExchangeMeta>;
|
|
601
593
|
|
|
602
|
-
/**
|
|
603
|
-
* @module voltlog-io
|
|
604
|
-
* @description OpenTelemetry middleware — automatically picks up the active trace context.
|
|
605
|
-
* Works like Winston's @opentelemetry/instrumentation-winston but as a simple middleware.
|
|
606
|
-
*
|
|
607
|
-
* @server-only Requires `@opentelemetry/api` as an optional peer dependency.
|
|
608
|
-
*
|
|
609
|
-
* When the OpenTelemetry SDK is active (e.g., with SigNoz, Jaeger, Grafana Tempo),
|
|
610
|
-
* this middleware automatically injects traceId, spanId, and traceFlags into every log entry.
|
|
611
|
-
*
|
|
612
|
-
* @example
|
|
613
|
-
* ```ts
|
|
614
|
-
* import { createLogger, otelTraceMiddleware, otelTransport } from 'voltlog-io';
|
|
615
|
-
*
|
|
616
|
-
* const logger = createLogger({
|
|
617
|
-
* middleware: [otelTraceMiddleware()],
|
|
618
|
-
* transports: [
|
|
619
|
-
* otelTransport({
|
|
620
|
-
* endpoint: 'http://localhost:4318',
|
|
621
|
-
* serviceName: 'my-app',
|
|
622
|
-
* }),
|
|
623
|
-
* ],
|
|
624
|
-
* });
|
|
625
|
-
*
|
|
626
|
-
* // If an OTel span is active, every log automatically gets:
|
|
627
|
-
* // { traceId: "abc123...", spanId: "def456...", traceFlags: 1 }
|
|
628
|
-
* logger.info("Processing request");
|
|
629
|
-
* ```
|
|
630
|
-
*/
|
|
631
|
-
|
|
632
|
-
interface OtelTraceMiddlewareOptions {
|
|
633
|
-
/**
|
|
634
|
-
* Custom reference to `@opentelemetry/api` trace module.
|
|
635
|
-
* If not provided, we attempt `require('@opentelemetry/api')` or dynamic import.
|
|
636
|
-
* This allows the middleware to work without a hard dependency.
|
|
637
|
-
*/
|
|
638
|
-
traceApi?: {
|
|
639
|
-
trace: {
|
|
640
|
-
getActiveSpan: () => unknown;
|
|
641
|
-
};
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Middleware that automatically injects OpenTelemetry trace context into log entries.
|
|
646
|
-
*
|
|
647
|
-
* How it works:
|
|
648
|
-
* 1. On each log call, checks for an active OTel span
|
|
649
|
-
* 2. If found, extracts traceId, spanId, and traceFlags
|
|
650
|
-
* 3. Injects them into the log entry's metadata
|
|
651
|
-
*
|
|
652
|
-
* This is the equivalent of Winston's @opentelemetry/instrumentation-winston
|
|
653
|
-
* but implemented as a zero-dependency middleware.
|
|
654
|
-
*/
|
|
655
|
-
declare function otelTraceMiddleware<TMeta = Record<string, unknown>>(options?: OtelTraceMiddlewareOptions): LogMiddleware<TMeta>;
|
|
656
|
-
|
|
657
594
|
/**
|
|
658
595
|
* @module voltlog-io
|
|
659
596
|
* @description Redaction middleware — masks sensitive data in log entries.
|
|
@@ -1244,4 +1181,4 @@ interface WebhookTransportOptions {
|
|
|
1244
1181
|
*/
|
|
1245
1182
|
declare function webhookTransport(options: WebhookTransportOptions): Transport;
|
|
1246
1183
|
|
|
1247
|
-
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 };
|
|
@@ -476,14 +476,6 @@ interface HttpLoggerOptions<TReq = any, TRes = any> {
|
|
|
476
476
|
/** Function to skip logging certain requests (e.g., /health) */
|
|
477
477
|
skip?: (req: TReq) => boolean;
|
|
478
478
|
}
|
|
479
|
-
/**
|
|
480
|
-
* Common mappers for the raw Node.js `http.IncomingMessage` and `http.ServerResponse`.
|
|
481
|
-
* Since Express and many others extend these objects, they work universally.
|
|
482
|
-
*/
|
|
483
|
-
declare const nodeHttpMappers: {
|
|
484
|
-
req: HttpRequestMapper;
|
|
485
|
-
res: HttpResponseMapper;
|
|
486
|
-
};
|
|
487
479
|
/**
|
|
488
480
|
* Creates a generic HTTP logging middleware function.
|
|
489
481
|
* Use this inside Express, Fastify, or custom routers.
|
|
@@ -599,61 +591,6 @@ interface OcppMiddlewareOptions {
|
|
|
599
591
|
*/
|
|
600
592
|
declare function ocppMiddleware(options?: OcppMiddlewareOptions): LogMiddleware<OcppExchangeMeta>;
|
|
601
593
|
|
|
602
|
-
/**
|
|
603
|
-
* @module voltlog-io
|
|
604
|
-
* @description OpenTelemetry middleware — automatically picks up the active trace context.
|
|
605
|
-
* Works like Winston's @opentelemetry/instrumentation-winston but as a simple middleware.
|
|
606
|
-
*
|
|
607
|
-
* @server-only Requires `@opentelemetry/api` as an optional peer dependency.
|
|
608
|
-
*
|
|
609
|
-
* When the OpenTelemetry SDK is active (e.g., with SigNoz, Jaeger, Grafana Tempo),
|
|
610
|
-
* this middleware automatically injects traceId, spanId, and traceFlags into every log entry.
|
|
611
|
-
*
|
|
612
|
-
* @example
|
|
613
|
-
* ```ts
|
|
614
|
-
* import { createLogger, otelTraceMiddleware, otelTransport } from 'voltlog-io';
|
|
615
|
-
*
|
|
616
|
-
* const logger = createLogger({
|
|
617
|
-
* middleware: [otelTraceMiddleware()],
|
|
618
|
-
* transports: [
|
|
619
|
-
* otelTransport({
|
|
620
|
-
* endpoint: 'http://localhost:4318',
|
|
621
|
-
* serviceName: 'my-app',
|
|
622
|
-
* }),
|
|
623
|
-
* ],
|
|
624
|
-
* });
|
|
625
|
-
*
|
|
626
|
-
* // If an OTel span is active, every log automatically gets:
|
|
627
|
-
* // { traceId: "abc123...", spanId: "def456...", traceFlags: 1 }
|
|
628
|
-
* logger.info("Processing request");
|
|
629
|
-
* ```
|
|
630
|
-
*/
|
|
631
|
-
|
|
632
|
-
interface OtelTraceMiddlewareOptions {
|
|
633
|
-
/**
|
|
634
|
-
* Custom reference to `@opentelemetry/api` trace module.
|
|
635
|
-
* If not provided, we attempt `require('@opentelemetry/api')` or dynamic import.
|
|
636
|
-
* This allows the middleware to work without a hard dependency.
|
|
637
|
-
*/
|
|
638
|
-
traceApi?: {
|
|
639
|
-
trace: {
|
|
640
|
-
getActiveSpan: () => unknown;
|
|
641
|
-
};
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Middleware that automatically injects OpenTelemetry trace context into log entries.
|
|
646
|
-
*
|
|
647
|
-
* How it works:
|
|
648
|
-
* 1. On each log call, checks for an active OTel span
|
|
649
|
-
* 2. If found, extracts traceId, spanId, and traceFlags
|
|
650
|
-
* 3. Injects them into the log entry's metadata
|
|
651
|
-
*
|
|
652
|
-
* This is the equivalent of Winston's @opentelemetry/instrumentation-winston
|
|
653
|
-
* but implemented as a zero-dependency middleware.
|
|
654
|
-
*/
|
|
655
|
-
declare function otelTraceMiddleware<TMeta = Record<string, unknown>>(options?: OtelTraceMiddlewareOptions): LogMiddleware<TMeta>;
|
|
656
|
-
|
|
657
594
|
/**
|
|
658
595
|
* @module voltlog-io
|
|
659
596
|
* @description Redaction middleware — masks sensitive data in log entries.
|
|
@@ -1244,4 +1181,4 @@ interface WebhookTransportOptions {
|
|
|
1244
1181
|
*/
|
|
1245
1182
|
declare function webhookTransport(options: WebhookTransportOptions): Transport;
|
|
1246
1183
|
|
|
1247
|
-
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 };
|