Route stdlib logging through structlog for JSON asyncio exceptions (#4601)

Co-authored-by: Suchintan <suchintan@users.noreply.github.com>
Co-authored-by: Benji Visser <benji@093b.org>
This commit is contained in:
Shuchang Zheng
2026-02-03 08:11:45 -08:00
committed by GitHub
parent 66d6a8aa01
commit 8d0ad3901e

View File

@@ -314,6 +314,23 @@ def setup_logger() -> None:
+ additional_processors
+ [skyvern_logs_processor, renderer],
)
handler = logging.StreamHandler()
handler.setFormatter(
structlog.stdlib.ProcessorFormatter(
processors=[
structlog.stdlib.add_log_level,
structlog.stdlib.add_logger_name,
structlog.processors.TimeStamper(fmt="iso"),
structlog.processors.format_exc_info,
renderer,
]
)
)
root_logger = logging.getLogger()
root_logger.handlers.clear()
root_logger.addHandler(handler)
root_logger.setLevel(LOG_LEVEL_VAL)
uvicorn_error = logging.getLogger("uvicorn.error")
uvicorn_error.disabled = True
uvicorn_access = logging.getLogger("uvicorn.access")