jgdv.logging.config
Classes
Utility class to setup [stdout, stderr, file] logging. |
|
Mixin for redirecting builtins.print to a file |
Module Contents
- class jgdv.logging.config.JGDVLogConfig[source]
Utility class to setup [stdout, stderr, file] logging.
Also creates a ‘printer’ logger, so instead of using print, tasks can notify the user using the printer, which also includes the notifications into the general log trace
The Printer has a number of children, which can be controlled to customise verbosity.
- Standard _printer children::
action_exec, action_group, artifact, cmd, fail, header, help, queue, report, skip, sleep, success, task, task_header, task_loop, task_state, track
- _install_record_override() <Unknown>[source]
Sets a custom LogRecord subclass as the factory
- Return type:
None
- _setup_logging_extra(config) <Unknown>[source]
read the doot config logging section setting up each entry other than stream, file, printer, and subprinters
- Parameters:
config (jgdv.structs.chainguard.ChainGuard)
- Return type:
None
- activate_spec(
- spec,
- *,
- override=False,
Add a spec to the registry and activate it
- Parameters:
override (bool)
- Return type:
None
- subprinter(*names, prefix=None) <Unknown>[source]
Get a subprinter of the printer logger. The First name needs to be a registered subprinter. Additional names are unconstrained
- _initial_spec: jgdv.logging.logger_spec.LoggerSpec
- _printer_initial_spec: jgdv.logging.logger_spec.LoggerSpec
- _registry: dict[str, jgdv.logging.logger_spec.LoggerSpec]
- levels: ClassVar[type[jgdv.logging._interface.LogLevel_e]]
- record_cls: ClassVar[type[logging.LogRecord]]
- root: jgdv.logging._interface.Logger
- class jgdv.logging.config.PrintCapture_m[source]
Mixin for redirecting builtins.print to a file
- capture_printing_to_file(
- path=API.default_print_file,
- *,
- disable_warning=False,
Modifies builtins.print to also print to a file
Setup a file handler for a separate logger, to keep a trace of anything printed. Strips colour print command codes out of any string printed strings are logged at DEBUG level
- Parameters:
path (str | pathlib.Path)
disable_warning (bool)
- Return type:
None
- remove_print_capture() <Unknown>[source]
removes a previously advised builtins.print
- Return type:
None
- original_print: jgdv.Maybe[collections.abc.Callable]