liblog: Logging helping functions
Manage logging and logging helper functions.
- haddock.libs.liblog.add_handler(log_obj: Logger, handler: type[StreamHandlerT], stream: str | Path | TextIO, log_level: str = 'INFO', formatter: str = '[%(asctime)s %(module)s %(levelname)s] %(message)s') StreamHandlerT[source]
Add a logging Handler to the log object.
- haddock.libs.liblog.add_log_for_CLI(log: Logger, log_level: str, logfile: str | Path) None[source]
Configure log for command-line clients.
- haddock.libs.liblog.add_logfile_handler(log_obj: ~logging.Logger, *, handler: type[~haddock.core.typing.StreamHandlerT] = <class 'logging.FileHandler'>, stream: str | ~pathlib.Path | ~typing.TextIO = 'log', log_level: str = 'INFO', formatter: str = '[%(asctime)s %(module)s %(levelname)s] %(message)s') StreamHandlerT
Add a logging Handler to the log object.
- haddock.libs.liblog.add_loglevel_arg(parser: ArgumentParser) None[source]
Add log level argument to CLI.
- haddock.libs.liblog.add_stringio_handler(log_obj: ~logging.Logger, *, handler: type[~haddock.core.typing.StreamHandlerT] = <class 'logging.StreamHandler'>, stream: str | ~pathlib.Path | ~typing.TextIO = <_io.StringIO object>, log_level: str = 'INFO', formatter: str = '[%(asctime)s %(module)s %(levelname)s] %(message)s') StreamHandlerT
Add a logging Handler to the log object.
- haddock.libs.liblog.add_syserr_handler(log_obj: ~logging.Logger, *, handler: type[~haddock.core.typing.StreamHandlerT] = <class 'logging.StreamHandler'>, stream: str | ~pathlib.Path | ~typing.TextIO = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, log_level: str = 'ERROR', formatter: str = '[%(asctime)s %(module)s %(levelname)s] %(message)s') StreamHandlerT
Add a logging Handler to the log object.
- haddock.libs.liblog.add_sysout_handler(log_obj: ~logging.Logger, *, handler: type[~haddock.core.typing.StreamHandlerT] = <class 'logging.StreamHandler'>, stream: str | ~pathlib.Path | ~typing.TextIO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, log_level: str = 'INFO', formatter: str = '[%(asctime)s %(module)s %(levelname)s] %(message)s') StreamHandlerT
Add a logging Handler to the log object.
- haddock.libs.liblog.close_logfile_handlers(log: Logger) None[source]
Close and detach all file-based logging handlers.
This releases the open file descriptor on the run’s
logfile so it can be deleted cleanly. On non-local filesystems (NFS, FUSE object-store mounts such as gcsfuse or s3fs, overlayfs in containers, CIFS/SMB) deleting a still-open file might not remove it immediately, leaving the directory non-empty and causingrmtreeto fail withOSError: [Errno 39] Directory not empty.