.. _jgdv.logging.logger_spec: ======================== jgdv.logging.logger_spec ======================== .. py:module:: jgdv.logging.logger_spec Classes ------- .. autoapisummary:: jgdv.logging.logger_spec.HandlerBuilder_m jgdv.logging.logger_spec.LoggerSpec Module Contents =============== .. _jgdv.logging.logger_spec.HandlerBuilder_m: .. py:class:: HandlerBuilder_m Loggerspec Mixin for building handlers .. py:method:: _build_errorhandler() -> .. py:method:: _build_filehandler(path) -> .. py:method:: _build_filters() -> .. py:method:: _build_formatter(handler) -> .. py:method:: _build_rotatinghandler(path) -> .. py:method:: _build_streamhandler() -> .. py:method:: _discriminate_handler(target) -> .. _jgdv.logging.logger_spec.LoggerSpec: .. py:class:: LoggerSpec(/, **data) Bases: :py:obj:`HandlerBuilder_m`, :py:obj:`pydantic.BaseModel` A Spec for toml defined logging control. Allows user to name a logger, set its level, format, filters, colour, and what (cli arg) verbosity it activates on, and what file it logs to. When 'apply' is called, it gets the logger, and sets any relevant settings on it. .. py:method:: _validate_format(val) -> .. py:method:: _validate_level(val) -> .. py:method:: _validate_style(val) -> .. py:method:: _validate_target(val) -> .. py:method:: apply(*, onto = None) -> Apply this spec (and nested specs) to the relevant logger .. py:method:: build(data, **kwargs) -> :staticmethod: Build a single spec, or multiple logger specs targeting the same logger .. py:method:: clear() -> Clear the handlers for the logger referenced .. py:method:: fullname() -> .. py:method:: get() -> Get the logger this spec controls .. py:method:: logfile() -> .. py:method:: set_level(level) -> .. py:attribute:: RootName :type: ClassVar[str] :value: 'root' .. py:attribute:: _applied :type: bool :value: False .. py:attribute:: _logger :type: jgdv.Maybe[jgdv.logging._interface.Logger] :value: None .. py:attribute:: allow :type: list[str] :value: [] .. py:attribute:: base :type: jgdv.Maybe[str] :value: None .. py:attribute:: clear_handlers :type: bool :value: False .. py:attribute:: colour :type: bool | str :value: False .. py:attribute:: disabled :type: bool :value: False .. py:attribute:: filename_fmt :type: str :value: '%Y-%m-%d::%H:%M.log' .. py:attribute:: filter :type: list[str] :value: [] .. py:attribute:: format :type: str :value: '{levelname:<8} : {message}' .. py:attribute:: level :type: str | int :value: 30 .. py:attribute:: levels :type: ClassVar[type[enum.IntEnum]] .. py:attribute:: name :type: str .. py:attribute:: nested :type: list[LoggerSpec] :value: [] .. py:attribute:: prefix :type: jgdv.Maybe[str] :value: None .. py:attribute:: propagate :type: bool :value: False .. py:attribute:: style :type: str :value: '{' .. py:attribute:: target :type: list[str | pathlib.Path] :value: [] .. py:attribute:: verbosity :type: int :value: 0