python-structlog-config¶
Structured logging configuration with optional OpenTelemetry and Sentry integration.
Installation¶
pip install python-structlog-config
Public API¶
Function |
Purpose |
|---|---|
|
Core configuration |
|
Get structlog logger |
|
Dev preset: console, debug |
|
Prod preset: JSON, OTel, Sentry |
|
Test preset: minimal, warning |
|
OpenTelemetry integration |
|
Sentry integration |
Usage¶
from python_structlog_config import configure_for_development, get_logger
configure_for_development("my-service")
logger = get_logger(__name__)
logger.info("started", port=8000)
Production setup¶
from python_structlog_config import configure_for_production
configure_for_production(
service_name="api",
sentry_dsn="https://...",
log_level="INFO",
)