Set up logging.
This configures Uvicorn to use structlog for output formatting and installs a custom processor to parse its access log messages into additional log context that matches the format of Google log messages. This helps Google’s Cloud Logging system understand the logs.
The log level for Uvicorn logs, in string form (case-insensitive):
The default is
This method should normally be called after
configure_loggingduring FastAPI app creation. It should be called during Python module import or inside the function that creates and returns the FastAPI app that Uvicorn will run. This ensures the logging setup is complete before Uvicorn logs its first message.
- Return type: