Work on event program data importing.
This commit is contained in:
22
app/log.py
22
app/log.py
@@ -1,18 +1,24 @@
|
||||
import functools, logging
|
||||
|
||||
# stream options: 'ext://sys.stderr' or 'ext://sys.stdout'
|
||||
|
||||
# NOTE: This log config is confusing and may need work... 2022-10-07
|
||||
# 'uvicorn' under 'loggers' creates an output to the 'console' handler
|
||||
# Do not also add 'console' handler to the 'root' 'handlers' list
|
||||
# For now just using that to add or remove file logging options.
|
||||
logging.config.dictConfig({
|
||||
'version': 1,
|
||||
'formatters': {
|
||||
'default': {'format': '[%(asctime)s] %(levelname)s @ %(module)s.%(funcName)s()#%(lineno)d: %(message)s'},
|
||||
'long': {'format': '[%(asctime)s] %(levelname)s @ %(module)s.%(funcName)s()#%(lineno)d: %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S'},
|
||||
'short': {'format': '[%(asctime)s] %(levelname)s @ %(module)s.%(funcName)s()#%(lineno)d: %(message)s', 'datefmt': '%H:%M:%S'},
|
||||
'short': {'format': '[%(asctime)s] %(levelname)s @ %(module)s.%(funcName)s()#%(lineno)d: %(message)s', 'datefmt': '%H:%M:%S', 'use_colors': True},
|
||||
},
|
||||
#'filename': 'example.log',
|
||||
#'level': logging.ERROR,
|
||||
# 'level': logging.ERROR,
|
||||
'handlers': {
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
'stream': 'ext://sys.stderr',
|
||||
'formatter': 'short',
|
||||
},
|
||||
'log_file_all': {
|
||||
@@ -37,15 +43,23 @@ logging.config.dictConfig({
|
||||
'formatter': 'short',
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
# 'uvicorn': {'handlers': ['default'], 'level': 'INFO'},
|
||||
'uvicorn': {'handlers': ['console'], 'level': 'INFO'},
|
||||
# 'uvicorn.error': {'level': 'INFO', 'handlers': ['default'], 'propagate': True},
|
||||
# 'uvicorn.error': {'level': 'INFO', 'handlers': ['console'], 'propagate': True},
|
||||
# 'uvicorn.access': {'handlers': ['access'], 'level': 'INFO', 'propagate': False},
|
||||
},
|
||||
'root': {
|
||||
'handlers': ['console'], #, 'log_file_all', 'log_file_warning'],
|
||||
'handlers': ['log_file_all'], #, 'log_file_all', 'log_file_warning'],
|
||||
# 'handlers': ['console', 'log_file_all'], #, 'log_file_all', 'log_file_warning'],
|
||||
'level': 'WARNING', # WARNING
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
log = logging.getLogger('root')
|
||||
log.setLevel(logging.ERROR) # DEBUG > INFO > WARNING > ERROR > CRITICAL
|
||||
# log.setLevel(logging.INFO) # DEBUG > INFO > WARNING > ERROR > CRITICAL
|
||||
# logging.basicConfig(
|
||||
# format='[%(asctime)s] %(levelname)s @ %(module)s.%(funcName)s()#%(lineno)d: %(message)s'
|
||||
# )
|
||||
|
||||
Reference in New Issue
Block a user