2020-09-15 00:18:38 +00:00
|
|
|
import logging
|
|
|
|
import logging.config
|
|
|
|
|
2020-11-04 00:39:07 +00:00
|
|
|
LOG_DICT = {
|
2020-09-15 00:18:38 +00:00
|
|
|
'version': 1,
|
2020-11-04 00:39:07 +00:00
|
|
|
'formatters': {
|
|
|
|
'default': {
|
|
|
|
'format': '[%(asctime)s] [%(process)d] [%(levelname)7s] %(message)s',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'handlers': {
|
|
|
|
'wsgi': {
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
'stream': 'ext://flask.logging.wsgi_errors_stream',
|
|
|
|
'formatter': 'default'
|
|
|
|
},
|
|
|
|
'console': {
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
'formatter': 'default'
|
|
|
|
},
|
|
|
|
'null': {
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.NullHandler',
|
|
|
|
'formatter': 'default'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'loggers': {
|
|
|
|
'gunicorn': {
|
|
|
|
'handlers': ['console'],
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'propagate': False,
|
|
|
|
},
|
|
|
|
},
|
2020-09-15 00:18:38 +00:00
|
|
|
'root': {
|
|
|
|
'level': 'INFO',
|
|
|
|
'handlers': ['wsgi']
|
|
|
|
}
|
2020-11-04 00:39:07 +00:00
|
|
|
}
|
2020-09-15 00:18:38 +00:00
|
|
|
|
2020-11-04 00:39:07 +00:00
|
|
|
logging.config.dictConfig(LOG_DICT)
|
2020-09-15 00:18:38 +00:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
logger.info('Logging enabled.')
|
2020-11-04 00:39:07 +00:00
|
|
|
|
|
|
|
from logging_tree import printout
|
|
|
|
printout()
|