Skip to content

log

All the logging config and things are in here.

config module-attribute

config = LoggingConfig(
    root={"level": logging.getLevelName(settings.log.LEVEL), "handlers": ["queue_listener"]},
    formatters={
        "standard": {"()": structlog.stdlib.ProcessorFormatter, "processors": stdlib_processors}
    },
    loggers={
        "uvicorn.access": {
            "propagate": False,
            "level": settings.log.UVICORN_ACCESS_LEVEL,
            "handlers": ["queue_listener"],
        },
        "uvicorn.error": {
            "propagate": False,
            "level": settings.log.UVICORN_ERROR_LEVEL,
            "handlers": ["queue_listener"],
        },
        "saq": {
            "propagate": False,
            "level": settings.log.SAQ_LEVEL,
            "handlers": ["queue_listener"],
        },
        "sqlalchemy.engine": {
            "propagate": False,
            "level": settings.log.SQLALCHEMY_LEVEL,
            "handlers": ["queue_listener"],
        },
    },
)

Pre-configured log config for application deps.

While we use structlog for internal app logging, we still want to ensure that logs emitted by any of our dependencies are handled in a non- blocking manner.

configure

configure(processors)

Call to configure structlog on app startup.

The calls to structlog.get_logger() in controller.py and worker.py return proxies to the logger that is eventually called after this configurator function has been called. Therefore, nothing should try to log via structlog before this is called.