Before move to Gunicorn

This commit is contained in:
Lucas Mathews
2024-06-15 20:11:04 +02:00
parent a1d326c018
commit 1c614f23b6
11 changed files with 96 additions and 56 deletions

15
server/logger.py Normal file
View File

@@ -0,0 +1,15 @@
# Lucas Mathews - Fontys Student ID: 5023572
# Banking System Logger
import datetime
def timestamp():
"""Returns the current timestamp in the format 'YYYY-MM-DD HH:MM:SS'."""
return (datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
def event_logger(data_to_log:str):
"""Logs an event to the log file."""
import os
print(os.getcwd())
with open("log.txt", "a") as log_file:
log_file.write(f"{timestamp()} - {data_to_log}\n")