Bases: OutboundPort
ABC for logging.
Explicit inheritance is required — debug, info,
warning, and error are @abstractmethod stubs
that subclasses must implement.
Responsibilities
- Emit log messages at debug, info, warning, and error levels.
- Accept format-style
*args for string interpolation.
Non-Responsibilities
- Persist log output or rotate log files.
- Manage log levels, filters, or structured logging formats.
- Schedule async I/O — this is a synchronous contract.
Implementations MAY accept wider types for *args (e.g.
*args: object) — the port contract only constrains callers,
not implementors.
Example
log = MyLogger()
log.info("Order %s placed by user %s", "42", "alice")
log.error("Payment failed for order %s", "42")
Source code in src/forging_blocks/application/ports/outbound/logger_port.py
| class LoggerPort(OutboundPort):
"""ABC for logging.
Explicit inheritance is required — ``debug``, ``info``,
``warning``, and ``error`` are ``@abstractmethod`` stubs
that subclasses must implement.
Responsibilities:
- Emit log messages at debug, info, warning, and error levels.
- Accept format-style ``*args`` for string interpolation.
Non-Responsibilities:
- Persist log output or rotate log files.
- Manage log levels, filters, or structured logging formats.
- Schedule async I/O — this is a synchronous contract.
Implementations MAY accept wider types for ``*args`` (e.g.
``*args: object``) — the port contract only constrains callers,
not implementors.
Example:
```python
log = MyLogger()
log.info("Order %s placed by user %s", "42", "alice")
log.error("Payment failed for order %s", "42")
```
"""
@abstractmethod
def debug(self, msg: str, *args: str) -> None:
"""Log a debug message."""
@abstractmethod
def info(self, msg: str, *args: str) -> None:
"""Log an info message."""
@abstractmethod
def warning(self, msg: str, *args: str) -> None:
"""Log a warning message."""
@abstractmethod
def error(self, msg: str, *args: str) -> None:
"""Log an error message."""
|
debug(msg: str, *args: str) -> None
abstractmethod
Log a debug message.
Source code in src/forging_blocks/application/ports/outbound/logger_port.py
| @abstractmethod
def debug(self, msg: str, *args: str) -> None:
"""Log a debug message."""
|
info(msg: str, *args: str) -> None
abstractmethod
Log an info message.
Source code in src/forging_blocks/application/ports/outbound/logger_port.py
| @abstractmethod
def info(self, msg: str, *args: str) -> None:
"""Log an info message."""
|
warning(msg: str, *args: str) -> None
abstractmethod
Log a warning message.
Source code in src/forging_blocks/application/ports/outbound/logger_port.py
| @abstractmethod
def warning(self, msg: str, *args: str) -> None:
"""Log a warning message."""
|
error(msg: str, *args: str) -> None
abstractmethod
Log an error message.
Source code in src/forging_blocks/application/ports/outbound/logger_port.py
| @abstractmethod
def error(self, msg: str, *args: str) -> None:
"""Log an error message."""
|