From 493b5ca16e98bfe4e666aa97fe51860d6639899f Mon Sep 17 00:00:00 2001 From: Julien Buteau Date: Mon, 5 May 2025 21:50:04 +0200 Subject: [PATCH 1/2] Improves comments in timestamp implementation --- docs_tofupilot/logger/client/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs_tofupilot/logger/client/main.py b/docs_tofupilot/logger/client/main.py index 595755e..83e92f9 100644 --- a/docs_tofupilot/logger/client/main.py +++ b/docs_tofupilot/logger/client/main.py @@ -13,11 +13,10 @@ def __init__(self): self.logs = [] def emit(self, record): - # Format log with ISO-8601 timestamp (millisecond precision) for - # TofuPilot API + # Format log with ISO-8601 timestamp (UTC, ms) for TofuPilot API log_entry = { "level": record.levelname, - "timestamp": f"{datetime.fromtimestamp(record.created).isoformat(timespec='milliseconds')}Z", + "timestamp": datetime.utcfromtimestamp(record.created).isoformat(timespec="milliseconds") + "Z", "message": record.getMessage(), "source_file": record.filename, "line_number": record.lineno, From 332f680d48ece5e5616cddc45d45488a76585fe2 Mon Sep 17 00:00:00 2001 From: upview Date: Mon, 5 May 2025 19:50:22 +0000 Subject: [PATCH 2/2] Auto code format --- docs_tofupilot/logger/client/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs_tofupilot/logger/client/main.py b/docs_tofupilot/logger/client/main.py index 83e92f9..0c3f33f 100644 --- a/docs_tofupilot/logger/client/main.py +++ b/docs_tofupilot/logger/client/main.py @@ -16,7 +16,10 @@ def emit(self, record): # Format log with ISO-8601 timestamp (UTC, ms) for TofuPilot API log_entry = { "level": record.levelname, - "timestamp": datetime.utcfromtimestamp(record.created).isoformat(timespec="milliseconds") + "Z", + "timestamp": datetime.utcfromtimestamp(record.created).isoformat( + timespec="milliseconds" + ) + + "Z", "message": record.getMessage(), "source_file": record.filename, "line_number": record.lineno,