-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.py
51 lines (44 loc) · 1.18 KB
/
main.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
48
49
50
51
import logging
from logging import config as logging_config
LOGGING_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"default": {
"format": "%(asctime)s - [%(module)s:%(levelname)s] - %(message)s"
},
"root": {
"format": "ROOT - %(asctime)s - [%(module)s:%(levelname)s] - %(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "default"
},
"root_console": {
"class": "logging.StreamHandler",
"formatter": "root"
}
},
"loggers": {
"app": {
"handlers": ["console"],
"level": "INFO",
# Don't send it up my namespace for additional handling
"propagate": False
}
},
"root": {
"handlers": ["root_console"],
"level": "INFO"
}
}
def main():
logging_config.dictConfig(LOGGING_CONFIG)
logger = logging.getLogger(__name__)
logger.info('Hey, that was easy.')
app_logger = logging.getLogger('app')
app_logger.info('Hey, that was also easy.')
if __name__ == '__main__':
main()