Skip to content

Commit

Permalink
add missing config settings. Remove indentation issue in logger_setup
Browse files Browse the repository at this point in the history
  • Loading branch information
manugarri committed Dec 27, 2017
1 parent 1b6fe56 commit d9216c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/config_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@

LOG_LEVEL = logging.DEBUG
LOG_FILENAME = 'activity.log'
LOG_MAXBYTES = 1024
LOG_BACKUPS = 2
2 changes: 2 additions & 0 deletions app/config_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@

LOG_LEVEL = logging.INFO
LOG_FILENAME = 'activity.log'
LOG_MAXBYTES = 1024
LOG_BACKUPS = 2
4 changes: 3 additions & 1 deletion app/logger_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

TZ = pytz.timezone(app.config['TIMEZONE'])


def add_fields(_, level, event_dict):
''' Add custom fields to each record. '''
now = dt.datetime.now()
Expand All @@ -55,9 +56,10 @@ def add_fields(_, level, event_dict):

return event_dict


# Add a handler to write log messages to a file
if app.config.get('LOG_FILENAME'):
file_handler = RotatingFileHandler(filename=app.config['LOG_FILENAME'],
file_handler = RotatingFileHandler(filename=app.config['LOG_FILENAME'],
maxBytes=app.config['LOG_MAXBYTES'],
backupCount=app.config['LOG_BACKUPS'],
mode='a',
Expand Down

0 comments on commit d9216c3

Please sign in to comment.