From 006145dbf6aeba9dc89b41d8a2dd4d758ebb78e7 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Fri, 28 Jan 2022 13:20:08 +0100 Subject: [PATCH] Added some log --- saturn/server/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/saturn/server/__init__.py b/saturn/server/__init__.py index df80eee..a320e32 100644 --- a/saturn/server/__init__.py +++ b/saturn/server/__init__.py @@ -1,9 +1,12 @@ +import logging + import flask -from datetime import date, datetime from ..calendar import get_events +log = logging.getLogger('saturn-server') + def create_app( secret_key, password, @@ -17,7 +20,12 @@ def create_app( if flask.request.method == 'POST': if flask.request.form.get('password') == password: flask.session['logged'] = True - else: flask.session['failed'] = True + log.info(f'Successful login from ' + f'({flask.request.remote_addr})') + else: + flask.session['failed'] = True + log.warn(f'Failed login from ' + f'({flask.request.remote_addr})') return flask.redirect(flask.url_for('home')) if flask.session.get('logged', False):