Don't fail hard if the web app is initialized without access to a configuration file (e.g. from a ReadTheDocs build environment)

This commit is contained in:
Fabio Manganiello 2021-02-21 23:30:05 +01:00
parent aa5cbbce28
commit 10eb0c12aa

View file

@ -9,9 +9,13 @@ from platypush.backend.http.app.utils import get_routes
def initialize_logger():
logger = logging.getLogger('werkzeug')
try:
log_conf = Config.get('logging')
if 'level' in log_conf:
logger.setLevel(log_conf['level'])
except Exception as e:
logger.warning('Could not read logging level')
logger.exception(e)
## Webapp initialization