Render debug-mode HTTP errors with tracerite, replacing Starlette's formatter.
This commit is contained in:
@@ -13,7 +13,12 @@ import uvicorn
|
||||
from uvicorn import Config, Server
|
||||
|
||||
from .hostutil import parse_endpoints
|
||||
from .logging import install_access_log, patch_lifespan_logging, patch_log_config
|
||||
from .logging import (
|
||||
install_access_log,
|
||||
patch_lifespan_logging,
|
||||
patch_log_config,
|
||||
patch_server_error_middleware,
|
||||
)
|
||||
from .startupbox import print_box
|
||||
|
||||
tracerite.load() # Early load on CLI load (import server); uvicorn workers reload via log config
|
||||
@@ -114,6 +119,7 @@ def run( # noqa: PLR0913
|
||||
if access_log:
|
||||
install_access_log()
|
||||
patch_lifespan_logging()
|
||||
patch_server_error_middleware()
|
||||
uvicorn_config["access_log"] = False # We always bypass uvicorn's own access logging
|
||||
uvicorn_config["log_config"] = patch_log_config(log_config, access_log=access_log)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user