Silence SQLAlchemy logs
This commit is contained in:
@@ -38,12 +38,18 @@ def configure_logging() -> None:
|
|||||||
"uvicorn",
|
"uvicorn",
|
||||||
"uvicorn.error",
|
"uvicorn.error",
|
||||||
"uvicorn.access",
|
"uvicorn.access",
|
||||||
"sqlalchemy.engine",
|
|
||||||
"httpx",
|
"httpx",
|
||||||
"requests",
|
"requests",
|
||||||
]:
|
]:
|
||||||
logging.getLogger(name).setLevel(level)
|
logging.getLogger(name).setLevel(level)
|
||||||
|
|
||||||
|
# Hide SQLAlchemy engine chatter unless explicitly debugging.
|
||||||
|
# (You can still enable it by setting LOG_LEVEL=DEBUG and adjusting this.)
|
||||||
|
logging.getLogger("sqlalchemy").setLevel(logging.WARNING)
|
||||||
|
logging.getLogger("sqlalchemy.engine").setLevel(logging.WARNING)
|
||||||
|
logging.getLogger("sqlalchemy.pool").setLevel(logging.WARNING)
|
||||||
|
logging.getLogger("sqlalchemy.dialects").setLevel(logging.WARNING)
|
||||||
|
|
||||||
|
|
||||||
def log_kv(logger: logging.Logger, msg: str, **kv: Any) -> None:
|
def log_kv(logger: logging.Logger, msg: str, **kv: Any) -> None:
|
||||||
# Lightweight key-value logging without requiring JSON logging.
|
# Lightweight key-value logging without requiring JSON logging.
|
||||||
|
|||||||
Reference in New Issue
Block a user