Logging#
- class PatcherLog[source]#
Configures Patcherโs stdlib rotating file logger (under Application Support).
- 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._console.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._console.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]#
Per-class logger wrapper (
self.log = LogMe(self.__class__.__name__)).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.