.. _jgdv.logging.config: =================== jgdv.logging.config =================== .. py:module:: jgdv.logging.config Classes ------- .. autoapisummary:: jgdv.logging.config.JGDVLogConfig jgdv.logging.config.PrintCapture_m Module Contents =============== .. _jgdv.logging.config.JGDVLogConfig: .. py:class:: JGDVLogConfig 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 .. py:method:: _install_logger_override() -> .. py:method:: _install_record_override() -> Sets a custom LogRecord subclass as the factory .. py:method:: _register_new_names() -> .. py:method:: _setup_logging_extra(config) -> read the doot config logging section setting up each entry other than stream, file, printer, and subprinters .. py:method:: activate_spec(spec, *, override = False) -> Add a spec to the registry and activate it .. py:method:: report() -> Utility method to inspect the state of logging. .. py:method:: reset() -> Reset the config to the initial specs .. py:method:: set_level(level) -> Set the active logging level .. py:method:: setup(config, *, force = False) -> a setup that uses config values .. py:method:: subprinter(*names, prefix = None) -> Get a subprinter of the printer logger. The First name needs to be a registered subprinter. Additional names are unconstrained .. py:attribute:: _initial_spec :type: jgdv.logging.logger_spec.LoggerSpec .. py:attribute:: _printer_initial_spec :type: jgdv.logging.logger_spec.LoggerSpec .. py:attribute:: _registry :type: dict[str, jgdv.logging.logger_spec.LoggerSpec] .. py:attribute:: is_setup :type: bool .. py:attribute:: levels :type: ClassVar[type[jgdv.logging._interface.LogLevel_e]] .. py:attribute:: logger_cls :type: ClassVar[type[jgdv.logging._interface.Logger]] .. py:attribute:: record_cls :type: ClassVar[type[logging.LogRecord]] .. py:attribute:: root :type: jgdv.logging._interface.Logger .. _jgdv.logging.config.PrintCapture_m: .. py:class:: PrintCapture_m Mixin for redirecting builtins.print to a file .. py:method:: 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 .. py:method:: remove_print_capture() -> removes a previously advised builtins.print .. py:attribute:: original_print :type: jgdv.Maybe[collections.abc.Callable]