from logging import Logger
from typing import Any, TextIO

from kombu.utils.objects import cached_property
from typing_extensions import override

__all__ = ("LOG_LEVELS", "LogMixin", "get_loglevel", "setup_logging")

LOG_LEVELS: dict[str | int, int | str]
DISABLE_TRACEBACKS: str | None

class LogMixin:
    def debug(self, *args: Any, **kwargs: Any) -> None: ...
    def info(self, *args: Any, **kwargs: Any) -> None: ...
    def warn(self, *args: Any, **kwargs: Any) -> None: ...
    def error(self, *args: Any, **kwargs: Any) -> None: ...
    def critical(self, *args: Any, **kwargs: Any) -> None: ...
    def annotate(self, text: str) -> str: ...
    def log(self, severity: int, *args: Any, **kwargs: Any) -> None: ...
    def get_logger(self) -> Logger: ...
    def is_enabled_for(self, level: int | str) -> bool: ...
    def get_loglevel(self, level: int | str) -> int: ...
    @cached_property
    def logger(self) -> Logger: ...
    @property
    def logger_name(self) -> str: ...

class Log(LogMixin):
    _logger_name: str
    _logger: Logger | None

    def __init__(self, name: str, logger: Logger | None = ...) -> None: ...
    @override
    def get_logger(self) -> Logger: ...
    @property
    @override
    def logger_name(self) -> str: ...

def get_loglevel(level: str | int) -> int: ...
def setup_logging(
    loglevel: int | str | None = ..., logfile: str | TextIO | None = ...
) -> Logger: ...
def get_logger(logger: str | Logger) -> Logger: ...
def naive_format_parts(fmt: str) -> Any: ...
def safeify_format(
    fmt: str, args: tuple[Any, ...], filters: dict[str, Any] | None = ...
) -> Any: ...
