Handler Management¶
Stream, file, and global logger coordination.
HandlerManager
¶
Manages logging handlers - adding, removing, configuring.
add_file_handler
¶
add_file_handler(filename: str, config: LoggerConfigState, max_bytes: int = 10485760, backup_count: int = 5, level: logLevels = None, formatter: Optional[Formatter] = None, base_level: str = 'INFO') -> Optional[logging.Handler]
Add a rotating file handler.
flush_all_handlers
¶
Flush all handlers associated with the logger instance.
get_handler_info
¶
Get information about all attached handlers.
update_all_formatters
¶
update_all_formatters(config_state, env_metadata: Dict, global_stream_configured: bool = False)
Update formatters for all handlers based on new config.
update_handler_levels
¶
update_handler_levels(level: LogLevel, *, scope: Literal['owned', 'others', 'all'] = 'owned') -> None
Update handler levels on the WrenchCL logger instance.
scope='owned' -> only handlers tagged _wrench_owned (primary/managed) scope='others' -> only non-owned, user-attached handlers scope='all' -> both
GlobalLoggerManager
¶
Root-level logging governance: 1) Ensure root logger emits via WrenchCL formatters 2) Enable selective silencing for package loggers 3) Optionally install exception hooks and suppress std streams
refresh_root_formatter
¶
Re-bind the formatter for the root/global handler(s) to keep output shape (JSON/terminal fields) in sync with WrenchCL without touching levels or streams. No-ops if no global stream is configured.
set_root_level
¶
Explicitly set the root logger effective level (does not touch instance).