UNPKG

strogger

Version:

📊 A modern structured logging library with functional programming, duck-typing, and comprehensive third-party integrations

61 lines • 1.9 kB
import type { LogContext } from "../types"; export interface EnrichmentContext { correlationId?: string; traceId?: string; spanId?: string; parentSpanId?: string; sessionId?: string; userId?: string; requestId?: string; serviceName?: string; stage?: string; } export interface Enricher { name: string; enrich: (context: LogContext) => LogContext; } /** * Generates a unique correlation ID */ export declare const generateCorrelationId: () => string; /** * Generates a trace ID (compatible with OpenTelemetry format) */ export declare const generateTraceId: () => string; /** * Generates a span ID */ export declare const generateSpanId: () => string; /** * Generates a unique logger instance ID */ export declare const generateLoggerInstanceId: () => string; /** * Creates a correlation ID enricher */ export declare const createCorrelationEnricher: () => Enricher; /** * Creates a session enricher */ export declare const createSessionEnricher: (sessionId?: string) => Enricher; /** * Creates an environment enricher */ export declare const createEnvironmentEnricher: (serviceName?: string, stage?: string) => Enricher; /** * Creates a user enricher */ export declare const createUserEnricher: (userId?: string) => Enricher; /** * Creates a logger instance enricher */ export declare const createLoggerInstanceEnricher: (instanceId: string) => Enricher; /** * Creates an enrichment middleware that applies multiple enrichers */ export declare const createEnrichmentMiddleware: (enrichers: Enricher[]) => (context: LogContext) => LogContext; /** * Creates a default enrichment middleware with common enrichers */ export declare const createDefaultEnrichmentMiddleware: (serviceName?: string, stage?: string, sessionId?: string, instanceId?: string) => (context: LogContext) => LogContext; //# sourceMappingURL=enrichment.d.ts.map