import pino from 'pino';
import { AsyncLocalStorage } from 'async_hooks';
export interface LogContext {
    reqId?: string;
    user?: string;
    projectId?: string;
    wsId?: string;
    /** 跨 process 的相关性 id（sync/update 子系统），由调用方生成。 */
    runId?: string;
}
export declare const als: AsyncLocalStorage<LogContext>;
export declare function runWithContext<T>(ctx: LogContext, fn: () => T): T;
export declare function initLogger(): Promise<pino.Logger>;
/** Get the base logger. Caller MUST initLogger() first. */
export declare function getLogger(): pino.Logger;
/**
 * Module-scoped child logger.
 *
 * Safe to call at module top level: returns a lazy Proxy that defers the
 * actual `logger.child({ mod })` call until the first `.info/.warn/...`.
 * This lets any module do `const log = modLogger('x')` regardless of
 * import order relative to `initLogger()`.
 *
 * If called after init, child is created eagerly (no Proxy cost).
 *
 * Pre-init calls fall back to a console-shim — bootstrap-phase events
 * still surface via daemon stdout → `~/.ccweb/ccweb.log` (plan §11). Once
 * pino is ready, the Proxy swaps to the real child for the next call.
 */
export declare function modLogger(mod: string): pino.Logger;
/**
 * Install process-level uncaughtException / unhandledRejection handlers
 * that write the fatal record, then call flushSync on the pino-roll stream
 * (sonic-boom) before exit. Without the flushSync, sonic-boom's async buffer
 * would drop the very stack trace we most need to investigate
 * (reviewer Critical #1).
 *
 * Note: pino v10 removed `pino.final` — the recommended pattern is direct
 * flushSync on the sonic-boom destination (pino-roll returns a SonicBoom).
 */
export declare function installFatalHandlers(): void;
/**
 * Graceful flush — for SIGTERM / planned shutdown. Non-fatal path.
 * Returns a promise that resolves after pino has flushed.
 */
export declare function flushLogger(): Promise<void>;
//# sourceMappingURL=logger.d.ts.map