27 lines
662 B
Python
27 lines
662 B
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
import structlog
|
|
|
|
|
|
def _configure() -> None:
|
|
processors = [
|
|
structlog.processors.add_log_level,
|
|
structlog.processors.TimeStamper(fmt="iso", utc=False),
|
|
structlog.processors.StackInfoRenderer(),
|
|
structlog.processors.format_exc_info,
|
|
structlog.processors.JSONRenderer(sort_keys=True),
|
|
]
|
|
|
|
structlog.configure(
|
|
processors=processors,
|
|
wrapper_class=structlog.make_filtering_bound_logger(logging.INFO),
|
|
cache_logger_on_first_use=True,
|
|
)
|
|
|
|
|
|
_configure()
|
|
|
|
|
|
def get_logger() -> structlog.stdlib.BoundLogger:
|
|
return structlog.get_logger() |