Skip to content

[backport/1.4] core: Use ISO 8601 UTC timestamps for logs - #4126

Open
joaoantoniocardoso wants to merge 2 commits into
bluerobotics:1.4-devfrom
joaoantoniocardoso:backports/1.4/iso8601-log-timestamps
Open

[backport/1.4] core: Use ISO 8601 UTC timestamps for logs#4126
joaoantoniocardoso wants to merge 2 commits into
bluerobotics:1.4-devfrom
joaoantoniocardoso:backports/1.4/iso8601-log-timestamps

Conversation

@joaoantoniocardoso

@joaoantoniocardoso joaoantoniocardoso commented Aug 11, 2026

Copy link
Copy Markdown
Member

Backport of #4124 (c1e2190) into 1.4 + log filename fix for consistency.

  • tested.

nicoschmdt and others added 2 commits August 11, 2026 17:18
Different log formats make navigating and interpreting them confusing,
and local-time stamps are ambiguous across vehicles in different
timezones.

Unlike master, 1.4 registers a file sink in init_logger, so the format
is applied there as well. Without it the log files users download would
keep the old format and only stderr would be fixed.

Backport of c1e2190.
Log contents are now ISO 8601 UTC, but the filenames were still local
time, so a log dump disagreed with itself about the timezone.

The extended format is not filename friendly, so the basic format is
used instead. Lexicographic order still matches chronological order.
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as draft August 11, 2026 20:29
@joaoantoniocardoso joaoantoniocardoso changed the title core: Use ISO 8601 UTC timestamps for logs [backports/1.4] core: Use ISO 8601 UTC timestamps for logs Aug 11, 2026
@joaoantoniocardoso joaoantoniocardoso changed the title [backports/1.4] core: Use ISO 8601 UTC timestamps for logs [backport/1.4] core: Use ISO 8601 UTC timestamps for logs Aug 11, 2026
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: LGTM :shipit:

Backports the ISO 8601 UTC log timestamp change from master (#4124 / c1e2190) into 1.4-dev: adds ISO8601_LOG_FORMAT and applies it to both the stderr and file loguru sinks in commonwealth/utils/logs.py, switches get_new_log_path to a UTC basic-format timestamp (%Y%m%dT%H%M%SZ), and aligns the run-service.sh and log_zipper timestamps to UTC ISO 8601. The extra "log filename fix for consistency" (UTC + basic ISO format on the log filename) is a sensible companion to the format change and is documented inline with a why comment.

Spot-checks:

  • {time:YYYY-MM-DDTHH:mm:ss.SSS!UTC}Z — loguru's !UTC conversion + explicit Z suffix correctly emits UTC ISO 8601 with millisecond precision (MM = month, mm = minute, per Pendulum tokens).
  • init_logger calls logger.remove() before re-adding sinks, matching the master version; stderr is added before the file sink so a failure in get_new_log_path still leaves stderr logging functional.
  • run-service.sh uses date -u '+%Y-%m-%dT%H:%M:%SZ' — matches master byte-for-byte for the equivalent line.
  • log_zipper/main.py uses time.strftime("%Y%m%dT%H%M%SZ", time.gmtime()) — correctly gives UTC (gmtime rather than localtime).
  • import sys placement is alphabetically correct relative to import logging under isort's grouping.

No further comments, nice job 👍

Generated by PR Review Bot. This is advisory, a human reviewer must still approve.

@joaoantoniocardoso
joaoantoniocardoso marked this pull request as ready for review August 11, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants