-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging_config.py
47 lines (41 loc) · 1.07 KB
/
logging_config.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import logging
import logging.config
import os
LOG_LEVEL_APP = os.getenv("LOG_LEVEL_APP", "INFO")
LOG_LEVEL_GRPC = os.getenv("LOG_LEVEL_GRPC", "INFO")
LOG_LEVEL_RMQ = os.getenv("LOG_LEVEL_RMQ", "INFO")
LOGGING_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"simple": {
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
},
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "simple",
"level": "DEBUG",
},
},
"loggers": {
"app": {
"handlers": ["console"],
"level": LOG_LEVEL_APP,
"propagate": False,
},
"grpc": {
"handlers": ["console"],
"level": LOG_LEVEL_GRPC,
"propagate": False,
},
"rabbitmq_service": {
"handlers": ["console"],
"level": LOG_LEVEL_RMQ,
"propagate": False,
},
},
}
def setup_logging():
logging.config.dictConfig(LOGGING_CONFIG)