mirror of
https://github.com/WGDashboard/WGDashboard-PRW.git
synced 2026-08-04 15:02:59 +00:00
feat: configurable loglevel
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/bin/env python3
|
||||
|
||||
from logging.config import dictConfig
|
||||
|
||||
@staticmethod
|
||||
def setup_logger(level: str = 'DEBUG') -> None:
|
||||
dictConfig({
|
||||
'version': 1,
|
||||
'formatters': {
|
||||
'default': {
|
||||
'format': '[%(asctime)s] [%(levelname)s] in [%(module)s] %(message)s'
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'default',
|
||||
'level': level
|
||||
}
|
||||
},
|
||||
'root': {
|
||||
'handlers': ['console'],
|
||||
'level': level
|
||||
},
|
||||
'loggers': {
|
||||
'werkzeug': { # make werkzeug logs match
|
||||
'handlers': ['console'],
|
||||
'level': level,
|
||||
'propagate': False
|
||||
},
|
||||
'flask.app': { # make Flask internal logs match
|
||||
'handlers': ['console'],
|
||||
'level': level,
|
||||
'propagate': False
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -34,6 +34,4 @@ class utilities():
|
||||
|
||||
except Exception as err:
|
||||
log.critical('failed to create directory')
|
||||
return False
|
||||
|
||||
|
||||
return False
|
||||
Reference in New Issue
Block a user