Skip to content

Logger Port

logger_port

LoggerPort port for abstract logging.

Defines the LoggerPort protocol that application code depends on,
decoupling logging from any specific logging library.

LoggerPort

Bases: OutboundPort[object, object], Protocol

Structural protocol for logging.

Any object with debug, info, warning, and error
methods that accept a message string plus optional positional
arguments satisfies this protocol — no inheritance required.

Source code in src/forging_blocks/application/ports/outbound/logger_port.py
class LoggerPort(OutboundPort[object, object], Protocol):
    """Structural protocol for logging.

    Any object with ``debug``, ``info``, ``warning``, and ``error``
    methods that accept a message string plus optional positional
    arguments satisfies this protocol — no inheritance required.
    """

    def debug(self, msg: str, *args: object) -> None:
        """Log a debug message."""
        ...

    def info(self, msg: str, *args: object) -> None:
        """Log an info message."""
        ...

    def warning(self, msg: str, *args: object) -> None:
        """Log a warning message."""
        ...

    def error(self, msg: str, *args: object) -> None:
        """Log an error message."""
        ...

debug(msg: str, *args: object) -> None

Log a debug message.

Source code in src/forging_blocks/application/ports/outbound/logger_port.py
def debug(self, msg: str, *args: object) -> None:
    """Log a debug message."""
    ...

info(msg: str, *args: object) -> None

Log an info message.

Source code in src/forging_blocks/application/ports/outbound/logger_port.py
def info(self, msg: str, *args: object) -> None:
    """Log an info message."""
    ...

warning(msg: str, *args: object) -> None

Log a warning message.

Source code in src/forging_blocks/application/ports/outbound/logger_port.py
def warning(self, msg: str, *args: object) -> None:
    """Log a warning message."""
    ...

error(msg: str, *args: object) -> None

Log an error message.

Source code in src/forging_blocks/application/ports/outbound/logger_port.py
def error(self, msg: str, *args: object) -> None:
    """Log an error message."""
    ...