"""Convenience super-class to have a logger configured with the class name"""
    _log: logging.Logger | None = None
    def __init__(self, context=None):
        self._set_context(context)
    @property
    def log(self) -> Logger:
        """Returns a logger."""
        if self._log is None:
            self._log = logging.getLogger(self.__class__.__module__ + "." + self.__class__.__name__)
        return self._log
    def _set_context(self, context):
        if context is not None:
            set_context(self.log, context)
class ExternalLoggingMixin:
    """Define a log handler based on an external service (e.g. ELK, StackDriver)."""
    @property
    @abc.abstractmethod
    def log_name(self) -> str:
        """Return log name"""
    @abc.abstractmethod
    def get_external_log_url(self, task_instance, try_number) -> str:
        """Return the URL for log visualization in the external service."""
    @property
    @abc.abstractmethod
    def supports_external_link(self) -> bool:
        """Return whether handler is able to support external links."""
class StreamLogWriter(IOBase, IO[str]):