Logging¶
- class PatcherLog[source]¶
- static setup_logger(name: str | None = None, level: int | None = 20) Logger[source]¶
Configures and returns the Patcher logger with a rotating file handler.
Pure stdlib, no terminal output. Console / colored output is installed separately by the CLI via
patcher.cli.terminal_logger.install_terminal_handler(); library callers get file logging only.
- static setup_child_logger(childName: str, loggerName: str | None = None) Logger[source]¶
Setup a child logger for a specified context.
- static custom_excepthook(exc_type: Type[BaseException], exc_value: BaseException, exc_traceback: TracebackType | None) None[source]¶
Logs unhandled exceptions to Patcher’s log file. Pure file logging, no terminal output. The CLI installs a chained excepthook that adds user-facing stderr messages on top of this one (see
patcher.cli.terminal_logger.install_terminal_excepthook()).KeyboardInterruptis treated as a graceful exit (logged at INFO, process exits 130). All other uncaught exceptions are logged at ERROR.- Parameters:
exc_type (Type[BaseException]) – The class of the exception raised.
exc_value (BaseException) – The instance of the exception raised.
exc_traceback (TracebackType | None) – The traceback object associated with the exception.
- Return type:
None
- class LogMe(class_name: str)[source]¶
Thin wrapper around a stdlib
logging.Loggerscoped to a class name. Adds nothing beyond the file logging configured byPatcherLog.setup_logger(); terminal-color output is the CLI’s responsibility.- Parameters:
class_name (str) – The name of the class for which the logger is being set up.