set log level from config file
Read the log level settings from the "loglevel" value in the "bitmessagesettings" section of the config file. The possible values map directly to the ones allowed by the logger module: DEBUG, INFO, WARNING, ERROR, CRITICAL Only allow these values, and cast to upper case to be more easy going in the settings.
This commit is contained in:
parent
b3afbb4308
commit
2d6d3d68f6
|
@ -24,7 +24,9 @@ import helper_startup
|
||||||
helper_startup.loadConfig()
|
helper_startup.loadConfig()
|
||||||
|
|
||||||
# TODO(xj9): Get from a config file.
|
# TODO(xj9): Get from a config file.
|
||||||
log_level = 'DEBUG'
|
possible_log_levels = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
|
||||||
|
config_log_level = shared.config.get('bitmessagesettings', 'loglevel').upper()
|
||||||
|
log_level = config_log_level if config_log_level in possible_log_levels else 'DEBUG'
|
||||||
|
|
||||||
def configureLogging():
|
def configureLogging():
|
||||||
logging.config.dictConfig({
|
logging.config.dictConfig({
|
||||||
|
|
Reference in New Issue
Block a user