/** * Request context for propagating metadata (requestId, etc.) across async boundaries. * * The consumer (e.g., backend) must call setContextStorage() with an AsyncLocalStorage * instance before any requests are processed. The logger package itself has zero * Node.js-specific imports, so it works in any environment. */ interface ContextStorage { run(context: Record, fn: () => void): void; getStore(): Record | undefined; } /** * Inject the async context storage (call once at app startup). * In Node.js: pass `new AsyncLocalStorage()` from `node:async_hooks`. */ export declare function setContextStorage(s: ContextStorage): void; /** * Run a function within a request context. * All loggers called within fn will automatically include the context metadata. */ export declare function runWithContext(context: Record, fn: () => void): void; /** * Get the current request context (if any). */ export declare function getContext(): Record | undefined; export {}; //# sourceMappingURL=async-context.d.ts.map