You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
929 B
Python
30 lines
929 B
Python
import logging.config
|
|
import sys
|
|
|
|
FORMAT = "[%(asctime)s] [PID %(process)d] [%(threadName)s] [%(request_id)s] [%(name)s] [%(levelname)s] %(message)s" # noqa
|
|
|
|
|
|
def setup_logging():
|
|
logging.config.dictConfig(
|
|
{
|
|
"disable_existing_loggers": False,
|
|
"version": 1,
|
|
"filters": {
|
|
"request_id": {"()": "molten.contrib.request_id.RequestIdFilter"}
|
|
},
|
|
"formatters": {"console": {"format": FORMAT}},
|
|
"handlers": {
|
|
"default": {
|
|
"level": "DEBUG",
|
|
"class": "logging.StreamHandler",
|
|
"stream": sys.stderr,
|
|
"formatter": "console",
|
|
"filters": ["request_id"],
|
|
}
|
|
},
|
|
"loggers": {
|
|
"": {"handlers": ["default"], "level": "DEBUG", "propagate": False}
|
|
},
|
|
}
|
|
)
|