diff --git a/src/isolate/logger.py b/src/isolate/logger.py index 424514e..23e4f5e 100644 --- a/src/isolate/logger.py +++ b/src/isolate/logger.py @@ -1,5 +1,6 @@ import json import os +from datetime import datetime, timezone from typing import Dict from isolate.logs import LogLevel, LogSource @@ -16,6 +17,9 @@ def __init__(self, log_labels: Dict[str, str]): def log(self, level: LogLevel, message: str, source: LogSource) -> None: record = { + # Set the timestamp from source so we can be sure no buffering or + # latency is affecting the timestamp. + "logged_at": datetime.now(tz=timezone.utc).isoformat(), "isolate_source": source.name, "level": level.name, "message": message,