Skip to content

Commit

Permalink
Merge pull request #5 from TorSpider/fix-log-levels
Browse files Browse the repository at this point in the history
Fix log levels
  • Loading branch information
artagel authored Feb 24, 2018
2 parents f5b804b + ec9a032 commit 029aabc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def read_config():
'WTF_CSRF_SECRET_KEY': config['WTForms'].get('WTF_CSRF_SECRET_KEY')
}
my_config['LOGGING'] = {
'loglevel': logging.getLevelName(config['LOGGING'].get('loglevel'))
'loglevel': logging.getLevelName(config['LOGGING'].get('loglevel')),
'apploglevel': logging.getLevelName(config['LOGGING'].get('apploglevel'))
}
return my_config
except Exception as e:
Expand Down Expand Up @@ -74,7 +75,8 @@ def make_config():
'WTF_CSRF_SECRET_KEY': 'please-change-me'
}
default_config['LOGGING'] = {
'loglevel': 'INFO'
'loglevel': 'INFO',
'apploglevel': 'CRITICAL'
}
with open(os.path.join(script_dir, 'frontend.cfg'), 'w') as config_file:
default_config.write(config_file)
Expand All @@ -93,6 +95,7 @@ class ProductionConf(object):
server_config = read_config()

LOG_LEVEL = server_config['LOGGING'].get('loglevel')
APP_LOG_LEVEL = server_config['LOGGING'].get('apploglevel')
SQLALCHEMY_DATABASE_URI = "postgresql://{}:{}@{}:5432/{}".format(server_config['Database'].get('user'),
server_config['Database'].get('password'),
server_config['Database'].get('host'),
Expand Down
3 changes: 2 additions & 1 deletion frontend_manage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#! /usr/bin/env python3
from os import environ
import os
import sys
Expand Down Expand Up @@ -38,6 +38,7 @@ def run():
log.setLevel(app.config['LOG_LEVEL'])
log.addHandler(handler)
app.logger.addHandler(handler)
app.logger.setLevel(app.config['APP_LOG_LEVEL'])
port = int(environ.get('PORT', app.config['LISTEN_PORT']))
addr = environ.get('LISTEN_ADDR', app.config['LISTEN_ADDR'])
if app.config['USETLS']:
Expand Down

0 comments on commit 029aabc

Please sign in to comment.