Skip to content

Commit

Permalink
feat: add log timestamp when processing (#161)
Browse files Browse the repository at this point in the history
* feat: add log timestamp when processing

* use different name to avoid confusion
  • Loading branch information
chamini2 authored Oct 30, 2024
1 parent f09e4a1 commit 6d20281
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/isolate/logger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
from datetime import datetime, timezone
from typing import Dict

from isolate.logs import LogLevel, LogSource
Expand All @@ -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,
Expand Down

0 comments on commit 6d20281

Please sign in to comment.