Skip to content

Instantly share code, notes, and snippets.

@sakku116
Created March 8, 2023 03:15
Show Gist options
  • Save sakku116/880009c87cc02b739fe104b0145db5c4 to your computer and use it in GitHub Desktop.
Save sakku116/880009c87cc02b739fe104b0145db5c4 to your computer and use it in GitHub Desktop.
import uvicorn
from uvicorn.config import LOGGING_CONFIG
# default uvicorn format
LOGGING_CONFIG["formatters"]["default"]["fmt"] = "%(asctime)s %(levelprefix)s %(message)s"
LOGGING_CONFIG["formatters"]["default"]["datefmt"] = "%Y-%m-%d %H:%M:%S"
# api call format
LOGGING_CONFIG["formatters"]["access"]["fmt"] = '%(asctime)s %(levelprefix)s %(client_addr)s - "%(request_line)s" %(status_code)s'
LOGGING_CONFIG["formatters"]["access"]["datefmt"] = "%Y-%m-%d %H:%M:%S"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment