Logger

Interface for application-wide logging services.

Overview

The Logger class is an Abstract Base Class (ABC) that establishes the contract for any logging implementation within the application.

By using this interface, the application follows the Dependency Inversion Principle, allowing developers to swap logging backends (e.g., Console, File, CloudWatch, Sentry) without modifying the core business logic.

Abstract Methods

All classes inheriting from Logger must implement the following methods:

info(message: str)

Logs an informational message. Used for general application flow tracking.

debug(message: str)

Logs a debug message. Intended for detailed diagnostic information useful during development.

warning(message: str)

Logs a warning message. Used to indicate potential issues or unexpected events that don't stop the app.

error(message: str)

Logs an error message. Used for runtime errors, exceptions, or critical failures.

Implementation Example

To use this interface, create a subclass and implement the decorated methods:

# Example implementation
class ConsoleLogger(Logger):
    def info(self, message: str):
        print(f"[INFO]: {message}")