jgdv.logging.logger_spec
Classes
Loggerspec Mixin for building handlers |
|
A Spec for toml defined logging control. |
Module Contents
- class jgdv.logging.logger_spec.HandlerBuilder_m[source]
Loggerspec Mixin for building handlers
- _build_filehandler(path) <Unknown>[source]
- Parameters:
path (pathlib.Path)
- Return type:
jgdv.logging._interface.Handler
- _build_formatter(handler) <Unknown>[source]
- Parameters:
handler (jgdv.logging._interface.Handler)
- Return type:
jgdv.logging._interface.Formatter
- _build_rotatinghandler(path) <Unknown>[source]
- Parameters:
path (pathlib.Path)
- Return type:
jgdv.logging._interface.Handler
- _discriminate_handler(target) <Unknown>[source]
- Parameters:
target (jgdv.Maybe[str | pathlib.Path])
- Return type:
tuple[jgdv.Maybe[jgdv.logging._interface.Handler], jgdv.Maybe[jgdv.logging._interface.Formatter]]
- class jgdv.logging.logger_spec.LoggerSpec(/, **data)[source]
Bases:
HandlerBuilder_m,pydantic.BaseModelA 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.
- Parameters:
data (Any)
- _validate_target(val) <Unknown>[source]
- Parameters:
val (list | str | pathlib.Path)
- Return type:
list[str | pathlib.Path]
- apply(*, onto=None) <Unknown>[source]
Apply this spec (and nested specs) to the relevant logger
- Parameters:
onto (jgdv.Maybe[jgdv.logging._interface.Logger])
- Return type:
jgdv.logging._interface.Logger
- static build(data, **kwargs) <Unknown>[source]
Build a single spec, or multiple logger specs targeting the same logger
- Parameters:
- Return type:
- get() <Unknown>[source]
Get the logger this spec controls
- Return type:
jgdv.logging._interface.Logger
- _logger: jgdv.Maybe[jgdv.logging._interface.Logger] = None
- levels: ClassVar[type[enum.IntEnum]]
- nested: list[LoggerSpec] = []
- target: list[str | pathlib.Path] = []