From c84926fd93478b878924f3f491f89a66c03c34d2 Mon Sep 17 00:00:00 2001 From: Charles Le Maux Date: Tue, 20 Aug 2024 19:35:36 +0200 Subject: [PATCH] [+] New history system Now every server related event is logged. Users will soon be able to access their server's history on the front as well. Co-authored-by: Antoninop --- file_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file_manager.py b/file_manager.py index 40e3a19..3159400 100644 --- a/file_manager.py +++ b/file_manager.py @@ -72,7 +72,7 @@ async def log_error(error_type: str, error_message: str): logger.error(f'{error_type}: {error_message}') -def log_action(user_id: str, name: str, action: str, details: str = None): +async def log_action(user_id: str, name: str, action: str, details: str = None): log_file = f"users/{user_id}/{name}/history.log" event_log = { "timestamp": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), @@ -83,7 +83,7 @@ def log_action(user_id: str, name: str, action: str, details: str = None): with open(log_file, "a+") as log_file: log_file.write(json.dumps(event_log) + "\n") except Exception as e: - log_error(type(e).__name__, str(e)+" error trying to access history file on not existing server.") + await log_error(type(e).__name__, str(e) + " error trying to access history file on not existing server.") def kebab_to_camel_case(s: str) -> str: