-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
40 lines (27 loc) · 975 Bytes
/
Copy path__init__.py
File metadata and controls
40 lines (27 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Minimal structlog compatibility layer for offline environments."""
from __future__ import annotations
import logging
from typing import Any
from . import processors, stdlib # noqa: F401 (re-exported)
_CONFIGURED = False
def configure(*args: Any, **kwargs: Any) -> None:
"""Lightweight replacement for :func:`structlog.configure`.
The real library wires a complex processor pipeline. Our fallback simply
ensures the standard logging module is initialised so calls to
:func:`get_logger` return usable loggers.
"""
global _CONFIGURED
if not _CONFIGURED:
level = kwargs.get("cache_logger_on_first_use")
logging.basicConfig(level=logging.INFO)
_CONFIGURED = True
def get_logger(name: str | None = None) -> logging.Logger:
"""Return a standard library logger."""
configure()
return logging.getLogger(name or "fixops")
__all__ = [
"configure",
"get_logger",
"processors",
"stdlib",
]