"""
This type stub file was generated by pyright.
"""
from abc import ABC, abstractmethod
from enum import Enum
from typing import Dict, Optional
class LogLevel(Enum):
DEFAULT = ...
DEBUG = ...
INFO = ...
SUCCESS = ...
WARNING = ...
ERROR = ...
CRITICAL = ...
ALERT = ...
NOTICE = ...
EXCEPTION = ...
FATAL = ...
def __str__(self) -> str:
...
class LogColor(str, Enum):
"""Enum for log colors."""
DEBUG = ...
INFO = ...
SUCCESS = ...
WARNING = ...
ERROR = ...
CYAN = ...
GREEN = ...
YELLOW = ...
MAGENTA = ...
DIM_MAGENTA = ...
RED = ...
def __str__(self) -> str:
"""Automatically convert rich color to string."""
...
class AsyncLoggerBase(ABC):
@abstractmethod
def debug(self, message: str, tag: str = ..., **kwargs): # -> None:
...
@abstractmethod
def info(self, message: str, tag: str = ..., **kwargs): # -> None:
...
@abstractmethod
def success(self, message: str, tag: str = ..., **kwargs): # -> None:
...
@abstractmethod
def warning(self, message: str, tag: str = ..., **kwargs): # -> None:
...
@abstractmethod
def error(self, message: str, tag: str = ..., **kwargs): # -> None:
...
@abstractmethod
def url_status(self, url: str, success: bool, timing: float, tag: str = ..., url_length: int = ...): # -> None:
...
@abstractmethod
def error_status(self, url: str, error: str, tag: str = ..., url_length: int = ...): # -> None:
...
class AsyncLogger(AsyncLoggerBase):
"""
Asynchronous logger with support for colored console output and file logging.
Supports templated messages with colored components.
"""
DEFAULT_ICONS = ...
DEFAULT_COLORS = ...
def __init__(self, log_file: Optional[str] = ..., log_level: LogLevel = ..., tag_width: int = ..., icons: Optional[Dict[str, str]] = ..., colors: Optional[Dict[LogLevel, LogColor]] = ..., verbose: bool = ...) -> None:
"""
Initialize the logger.
Args:
log_file: Optional file path for logging
log_level: Minimum log level to display
tag_width: Width for tag formatting
icons: Custom icons for different tags
colors: Custom colors for different log levels
verbose: Whether to output to console
"""
...
def debug(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log a debug message."""
...
def info(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log an info message."""
...
def success(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log a success message."""
...
def warning(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log a warning message."""
...
def critical(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log a critical message."""
...
def exception(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log an exception message."""
...
def fatal(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log a fatal message."""
...
def alert(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log an alert message."""
...
def notice(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log a notice message."""
...
def error(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log an error message."""
...
def url_status(self, url: str, success: bool, timing: float, tag: str = ..., url_length: int = ...): # -> None:
"""
Convenience method for logging URL fetch status.
Args:
url: The URL being processed
success: Whether the operation was successful
timing: Time taken for the operation
tag: Tag for the message
url_length: Maximum length for URL in log
"""
...
def error_status(self, url: str, error: str, tag: str = ..., url_length: int = ...): # -> None:
"""
Convenience method for logging error status.
Args:
url: The URL being processed
error: Error message
tag: Tag for the message
url_length: Maximum length for URL in log
"""
...
class AsyncFileLogger(AsyncLoggerBase):
"""
File-only asynchronous logger that writes logs to a specified file.
"""
def __init__(self, log_file: str) -> None:
"""
Initialize the file logger.
Args:
log_file: File path for logging
"""
...
def debug(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log a debug message to file."""
...
def info(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log an info message to file."""
...
def success(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log a success message to file."""
...
def warning(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log a warning message to file."""
...
def error(self, message: str, tag: str = ..., **kwargs): # -> None:
"""Log an error message to file."""
...
def url_status(self, url: str, success: bool, timing: float, tag: str = ..., url_length: int = ...): # -> None:
"""Log URL fetch status to file."""
...
def error_status(self, url: str, error: str, tag: str = ..., url_length: int = ...): # -> None:
"""Log error status to file."""
...