-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathlogging.py
More file actions
32 lines (27 loc) 路 893 Bytes
/
Copy pathlogging.py
File metadata and controls
32 lines (27 loc) 路 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from typing import Any
from pydantic import BaseModel
class LogConfig(BaseModel):
"""Logging configuration to be set for the server"""
LOGGER_NAME: str = "paste"
LOG_FORMAT: str = "%(levelprefix)s | %(asctime)s | %(message)s"
LOG_LEVEL: str = "DEBUG"
# Logging config
version: int = 1
disable_existing_loggers: bool = False
formatters: dict[str, dict[str, str]] = {
"default": {
"()": "uvicorn.logging.DefaultFormatter",
"fmt": LOG_FORMAT,
"datefmt": "%Y-%m-%d %H:%M:%S",
},
}
handlers: dict[str, dict[str, Any]] = {
"default": {
"formatter": "default",
"class": "logging.StreamHandler",
"stream": "ext://sys.stderr",
},
}
loggers: dict[str, dict[str, Any]] = {
LOGGER_NAME: {"handlers": ["default"], "level": LOG_LEVEL},
}