import dataclasses
from dataclasses import dataclass
from logfire._internal.constants import LEVEL_NUMBERS as LEVEL_NUMBERS
from opentelemetry._logs import LogRecord, Logger, LoggerProvider
from opentelemetry.util.types import _ExtendedAttributes
from threading import Lock
from typing import Any, overload
from weakref import WeakSet

@dataclass
class ProxyLoggerProvider(LoggerProvider):
    """A logger provider that wraps another internal logger provider allowing it to be re-assigned."""
    provider: LoggerProvider
    loggers: WeakSet[ProxyLogger] = dataclasses.field(default_factory=WeakSet)
    lock: Lock = dataclasses.field(default_factory=Lock)
    suppressed_scopes: set[str] = dataclasses.field(default_factory=set)
    min_level: int = ...
    def get_logger(self, name: str, version: str | None = None, schema_url: str | None = None, attributes: _ExtendedAttributes | None = None) -> Logger: ...
    def set_min_level(self, min_level: int) -> None: ...
    def suppress_scopes(self, *scopes: str) -> None: ...
    def set_provider(self, logger_provider: LoggerProvider) -> None: ...
    def __getattr__(self, item: str) -> Any: ...

@dataclass(eq=False)
class ProxyLogger(Logger):
    logger: Logger
    min_level: int
    name: str
    version: str | None = ...
    schema_url: str | None = ...
    attributes: _ExtendedAttributes | None = ...
    @overload
    def emit(self, record: LogRecord) -> None: ...
    @overload
    def emit(self, **kwargs: Any) -> None: ...
    def set_logger(self, provider: LoggerProvider) -> None: ...
    def __getattr__(self, item: str): ...
