From 7a2ac782182baa8c86ea02a30e36d18ed500a123 Mon Sep 17 00:00:00 2001 From: Jan Grewe Date: Tue, 10 Sep 2019 17:53:53 +0200 Subject: [PATCH] set log file buffering to line --- email_client.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/email_client.py b/email_client.py index 9966005..f6d8bd2 100644 --- a/email_client.py +++ b/email_client.py @@ -324,7 +324,7 @@ def check_for_mails(): new_participations = process_registrations(M) for p in new_participations: - print("\tNew registration by %s" % p.name, file=log_file) + print("%s\tNew registration by %s" % (dt.datetime.now().isoformat(), p.name), file=log_file) csv_file = p.save_to_csv() send_confirmation(p, csv_file) M.close() @@ -332,9 +332,7 @@ def check_for_mails(): if __name__ == "__main__": - with open('etho_registration.log', 'a') as log_file: + with open('etho_registration.log', 'a', buffering=1) as log_file: while True: - print("%s: Checking for new registrations mails!" % dt.datetime.now().isoformat(), - file=log_file) check_for_mails() time.sleep(60)