Skip to content

Logging

Loggable

Mixin class that adds a logger to a class instance with extra contextual information.

Source code in src/redsun/log.py
class Loggable:
    """Mixin class that adds a logger to a class instance with extra contextual information."""

    @cached_property
    def logger(self) -> _LoggerAdapter:
        """Logger instance with contextual information."""
        return ContextualAdapter(logging.getLogger("redsun"), self)

logger cached property

logger: _LoggerAdapter

Logger instance with contextual information.