import typing from typing import Callable class Logger: """A simple logger class that can be initialized with a logging function.""" def __init__(self) -> None: """Initializes the Logger, defaulting to the print function.""" self._log_func: Callable[[str], None] = print def init_logger(self, log_func: Callable[[str], None]) -> None: """ Initializes the logger with a specific logging function. Args: log_func: The function to use for logging. It should accept a single string argument. """ self._log_func = log_func def log(self, message: str) -> None: """ Logs a message using the configured logging function. Args: message: The message to log. """ self._log_func(message) # Global instance app_logger: Logger = Logger()