/** * Logger - Structured logger with env-var-based configuration. * * SIGNALWIRE_LOG_LEVEL: debug | info | warn | error (default: info) * SIGNALWIRE_LOG_MODE: off | stderr | auto (default: auto) * SIGNALWIRE_LOG_FORMAT: text | json (default: text) * SIGNALWIRE_LOG_COLOR: true | false (default: true when TTY and no CLI raw flags) */ declare const LEVELS: { readonly debug: 0; readonly info: 1; readonly warn: 2; readonly error: 3; }; /** Log severity level. */ type LogLevel = keyof typeof LEVELS; /** Output format for log entries. */ type LogFormat = 'text' | 'json'; /** Output stream routing. */ type LogStream = 'stdout' | 'stderr'; /** * Detect the execution environment, matching Python SDK's detection logic. * @returns A tuple of [environment_name, derived_log_mode]. */ export declare function getExecutionMode(): [string, 'off' | 'stderr' | 'default']; /** * Set the minimum log level for all loggers. * @param level - The minimum severity level to emit. */ export declare function setGlobalLogLevel(level: LogLevel): void; /** * Suppress or unsuppress all log output globally. * @param suppress - True to suppress, false to restore (default true). */ export declare function suppressAllLogs(suppress?: boolean): void; /** * Set the output format for all loggers. * @param format - Either 'text' (human-readable) or 'json' (structured). */ export declare function setGlobalLogFormat(format: LogFormat): void; /** * Enable or disable ANSI color codes in text-format output. * @param enabled - True to enable colors, false to disable. */ export declare function setGlobalLogColor(enabled: boolean): void; /** * Set the output stream for all loggers. * @param stream - Either 'stdout' (default) or 'stderr'. */ export declare function setGlobalLogStream(stream: LogStream): void; /** Reset all logging settings to their environment-variable-based defaults. */ export declare function resetLoggingConfiguration(): void; /** * Strip control characters from all string values in a data record to prevent * log injection attacks. Mirrors Python SDK's `strip_control_chars` structlog * processor. Processes nested objects and arrays recursively. * * @param data - The record whose string values should be sanitized. * @returns A shallow copy of `data` with control characters removed from strings. */ export declare function stripControlChars>(data: T): T; /** Structured logger that respects global level, format, and color settings. */ export declare class Logger { private name; private context; /** * Create a new Logger instance. * @param name - Logger name shown in log output. * @param context - Optional key-value pairs included in every log entry. */ constructor(name: string, context?: Record); /** * Create a child logger with additional bound context fields merged into the parent's context. * @param context - Key-value pairs to merge into the child logger's context. * @returns A new Logger instance with the merged context. */ bind(context: Record): Logger; /** * Log a message at the debug level. * @param msg - The log message. * @param data - Optional structured data to include. */ debug(msg: string, data?: Record): void; /** * Log a message at the info level. * @param msg - The log message. * @param data - Optional structured data to include. */ info(msg: string, data?: Record): void; /** * Log a message at the warn level. * @param msg - The log message. * @param data - Optional structured data to include. */ warn(msg: string, data?: Record): void; /** * Log a message at the error level. * @param msg - The log message. * @param data - Optional structured data to include. */ error(msg: string, data?: Record): void; private log; private logText; private logJson; private emit; } /** * Create or retrieve a cached Logger instance with the given name. * @param name - Logger name shown in log output. * @returns A Logger instance (cached by name). */ export declare function getLogger(name: string): Logger; export {};