import { Logger, StructuredLogger, LogEvent } from "./logger.type"; /** * Interface representing a context that can determine if replay is occurring. * This is used by ReplaySafeLogger to check if logging should be suppressed. */ export interface ReplayContext { /** * Whether the orchestrator is currently replaying from history. */ readonly isReplaying: boolean; } /** * A logger wrapper that only logs when the orchestration is not replaying. * * During orchestration replay, history events are re-processed to rebuild state. * This can cause duplicate log entries if not handled properly. The ReplaySafeLogger * wraps an existing logger and automatically suppresses log output during replay, * ensuring that logs are only written once when the orchestration is making forward progress. * * If the wrapped logger implements {@link StructuredLogger}, structured log events * will also be forwarded (and suppressed during replay). * * @example * ```typescript * // Inside an orchestrator function: * const logger = ctx.createReplaySafeLogger(myLogger); * logger.info("This will only be logged once, not during replay"); * ``` */ export declare class ReplaySafeLogger implements StructuredLogger { private readonly context; private readonly innerLogger; /** * Creates a new ReplaySafeLogger. * * @param context - The replay context used to determine if replay is occurring. * @param logger - The underlying logger to delegate to when not replaying. */ constructor(context: ReplayContext, logger: Logger); /** * Logs an error message if not replaying. * @param message - The error message to log. * @param args - Additional arguments to include in the log. */ error(message: string, ...args: unknown[]): void; /** * Logs a warning message if not replaying. * @param message - The warning message to log. * @param args - Additional arguments to include in the log. */ warn(message: string, ...args: unknown[]): void; /** * Logs an informational message if not replaying. * @param message - The informational message to log. * @param args - Additional arguments to include in the log. */ info(message: string, ...args: unknown[]): void; /** * Logs a debug message if not replaying. * @param message - The debug message to log. * @param args - Additional arguments to include in the log. */ debug(message: string, ...args: unknown[]): void; /** * Logs a structured event if not replaying. * If the inner logger supports structured logging, delegates to its `logEvent` method. * Otherwise, falls back to the appropriate plain log method. * * @param level - The log level. * @param event - Structured event metadata. * @param message - The formatted log message. */ logEvent(level: "error" | "warn" | "info" | "debug", event: LogEvent, message: string): void; }