Skip to content

Commit

Permalink
Only log to file if LOG_FILE is set
Browse files Browse the repository at this point in the history
Otherwise log to stdout
  • Loading branch information
fredriksvantes authored Aug 29, 2024
1 parent 3ef0237 commit 92d551d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
app.config['MAX_CONTENT_LENGTH'] = 15 * 1024 * 1024 # 15 Mb limit
recaptcha = ReCaptcha(app)

app.config['LOG_FILE'] = 'secure-drop.log'
logging.basicConfig(filename=app.config['LOG_FILE'], level=logging.INFO)
log_file = os.environ.get('LOG_FILE', '')
if log_file:
logging.basicConfig(filename=log_file, level=logging.INFO)
else:
logging.basicConfig(level=logging.INFO)

def parse_form(form):
text = form['message']
Expand Down

0 comments on commit 92d551d

Please sign in to comment.