From 7afc8d3637a461b7dba8474439852b19e5320adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= <78488229+viktor138irk@users.noreply.github.com> Date: Mon, 11 May 2026 23:35:36 +0900 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20runtime=20logs=20engine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/runtime_logs.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 backend/runtime_logs.py diff --git a/backend/runtime_logs.py b/backend/runtime_logs.py new file mode 100644 index 0000000..22641ad --- /dev/null +++ b/backend/runtime_logs.py @@ -0,0 +1,17 @@ +from datetime import datetime +from collections import deque + +MAX_LOGS = 500 + +runtime_logs = deque(maxlen=MAX_LOGS) + + +def add_log(message: str): + runtime_logs.appendleft({ + 'timestamp': datetime.utcnow().isoformat(), + 'message': message, + }) + + +def get_logs(limit: int = 100): + return list(runtime_logs)[:limit]