import { type LogLevelName, type SerializedError } from "./core.js"; export declare enum LogLevel { DEBUG = 0, INFO = 1, WARN = 2, ERROR = 3 } export type LogFormat = "text" | "json"; /** * Structured log entry for JSON output. * Fields are designed for easy Grafana/Loki filtering. */ export interface LogEntry { timestamp: string; level: LogLevelName; service: string; veryfrontVersion: string; message: string; component?: string; context?: Record; error?: SerializedError; /** @deprecated Use `request_id` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */ requestId?: string; /** @deprecated Use `trace_id` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */ traceId?: string; /** @deprecated Use `span_id` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */ spanId?: string; /** @deprecated Use `project_slug` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */ projectSlug?: string; request_id?: string; trace_id?: string; span_id?: string; project_slug?: string; request_url?: string; domain?: string; project_id?: string; process_role?: string; release_id?: string; branch_id?: string; branch_name?: string; run_execution_id?: string; run_id?: string; agent_id?: string; thread_id?: string; schedule_id?: string; schedule_name?: string; tool_name?: string; tool_call_id?: string; batch_id?: string; run_target?: string; task?: string; event_kind?: string; user_visible?: string; user_id?: string; conversation_id?: string; /** @deprecated Use `process_role` instead. Kept for dashboard transition. */ processRole?: string; /** @deprecated Use `user_id` instead. Kept for Grafana dashboard transition. */ userId?: string; /** @deprecated Use `conversation_id` instead. Kept for Grafana dashboard transition. */ conversationId?: string; /** @deprecated Use `duration_ms` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */ durationMs?: number; duration_ms?: number; } /** Public API contract for logger. */ export interface Logger { debug(message: string, ...args: unknown[]): void; info(message: string, ...args: unknown[]): void; warn(message: string, ...args: unknown[]): void; error(message: string, ...args: unknown[]): void; time(label: string, fn: () => Promise): Promise; /** * Create a child logger with additional context bound to all log entries. */ child(context: Record): Logger; /** * Create a component-scoped logger. The component name is included as a * structured `component` field in JSON output and rendered as `[component]` * in text output. */ component(name: string): Logger; } type ConsoleLoggerOptions = { injectTraceContext?: boolean; }; export type LogRecordEmitter = (entry: LogEntry) => void; /** * Determine the log level based on environment variables. * Exported for testing purposes. * @internal */ export declare function getDefaultLevel(envLevel?: string | undefined, debugFlag?: string | undefined): LogLevel; /** * Re-read logger configuration from environment variables. * Call after loading .env files so the logger picks up any overrides. * The active preset (cli/server) is preserved across refreshes. */ export declare function refreshLoggerConfig(): void; /** * Switch the text output format between server-style (timestamp + tag prefix) * and CLI-style (2-space indent + glyph only, no timestamp or tag). JSON output * is unaffected by this setting. Call before any framework code runs in CLI * entry points so framework messages render in the CLI's visual language. */ export declare function setLoggerPreset(preset: "cli" | "server"): void; /** * Override the active log level without re-reading environment variables. * Use when a verbosity flag (--verbose, --quiet) has been parsed and its effect * needs to propagate to all loggers immediately. */ export declare function setLogLevel(level: LogLevel): void; /** @internal Alias kept for tests. */ export declare const __resetLoggerConfigForTests: typeof refreshLoggerConfig; /** Register a process-level structured log emitter, for example an OTel bridge. */ export declare function __registerLogRecordEmitter(emitter: LogRecordEmitter | null): void; /** Subscribe to process-level structured log records. Returns an unregister function. */ export declare function __subscribeLogRecordEmitter(emitter: LogRecordEmitter): () => void; /** Reset the process-level structured log emitter. Only intended for tests. */ export declare function __resetLogRecordEmitterForTests(): void; declare class ConsoleLogger implements Logger { private prefix; private readonly options; private boundContext; private componentName?; constructor(prefix: string, boundContext?: Record, componentName?: string, options?: ConsoleLoggerOptions); child(context: Record): Logger; component(name: string): Logger; private createEmergencyEntry; private createEntry; private formatJson; private formatTextLine; private log; debug(message: string, ...args: unknown[]): void; info(message: string, ...args: unknown[]): void; warn(message: string, ...args: unknown[]): void; error(message: string, ...args: unknown[]): void; time(label: string, fn: () => Promise): Promise; } /** * Register the request context getter. * Called by request-context.ts during module initialization. * @internal */ export declare function __registerRequestContextGetter(getter: () => { logger: Logger; } | undefined): void; /** * Register the trace context getter. * Called by trace-bridge.ts after OTLP initialization. * @internal */ export declare function __registerTraceContextGetter(getter: () => { traceId?: string; spanId?: string; }): void; /** * Reset the trace context getter. * Only intended for testing purposes. * @internal */ export declare function __resetTraceContextGetterForTests(): void; export declare const cliLogger: Logger; /** Shared server logger value. */ export declare const serverLogger: Logger; /** Shared renderer logger value. */ export declare const rendererLogger: Logger; /** Shared bundler logger value. */ export declare const bundlerLogger: Logger; /** Shared agent logger value. */ export declare const agentLogger: Logger; export declare const proxyLogger: Logger; /** Shared logger value. */ export declare const logger: Logger; /** * Get the base logger without request context awareness. * Use this when you need to create a request-scoped logger in middleware. */ export declare function getBaseLogger(prefix: string, options?: ConsoleLoggerOptions): ConsoleLogger; /** * Create a logger for a specific request context. * Useful for binding request-specific metadata to all logs. */ export declare function createRequestLogger(baseLogger: Logger, requestContext: { requestId?: string; traceId?: string; projectSlug?: string; }): Logger; /** Create run user logger. */ export declare function createRunUserLogger(baseLogger: Logger, runContext: { projectId: string; runExecutionId: string; task: string; batchId?: string | null; runTarget?: string | null; eventKind?: string; }): Logger; export {}; //# sourceMappingURL=logger.d.ts.map