-
Notifications
You must be signed in to change notification settings - Fork 1
/
applogging.py
43 lines (38 loc) · 1.28 KB
/
applogging.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
#Copyright (c) 2022, Michael McFadden & Radio Free Asia
#GNU GENERAL PUBLIC LICENSE Version 2
#See file LICENCE or visit https://github.com/flipmcf/CasterPak/blob/master/LICENSE
from config import get_config
config = get_config()
import logging
level = logging.INFO
if config.getboolean('application', 'debug') is True:
level = logging.DEBUG
CASTERPAK_DEFAULT_LOGGING_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s', },
'cleanup': {'format': '[%(asctime)s] %(levelname)s CasterPak Cleanup: %(message)s', }
},
'handlers': {
'wsgi': {
'class': 'logging.StreamHandler',
'stream': 'ext://flask.logging.wsgi_errors_stream',
'formatter': 'default'
},
'vodhls': {
'class': 'logging.StreamHandler',
'stream': 'ext://flask.logging.wsgi_errors_stream',
'formatter': 'default',
},
'CasterPak-cleanup': {
'class': 'logging.StreamHandler',
'stream': 'ext://flask.logging.wsgi_errors_stream',
'formatter': 'cleanup'
},
},
'root': {
'level': level,
'handlers': ['wsgi']
},
}