Merge pull request #295 from emmanuel-ferdman/main

Migrate to modern datetime library API
This commit is contained in:
Marko Kraemer 2025-05-13 23:36:52 +02:00 committed by GitHub
commit 4849a15f96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ import logging
import json
import sys
import os
from datetime import datetime
from datetime import datetime, timezone
from contextvars import ContextVar
from functools import wraps
import traceback
@ -29,7 +29,7 @@ class JSONFormatter(logging.Formatter):
def format(self, record: logging.LogRecord) -> str:
"""Format log record as JSON with contextual information."""
log_data = {
'timestamp': datetime.utcnow().isoformat(),
'timestamp': datetime.now(timezone.utc).replace(tzinfo=None).isoformat(),
'level': record.levelname,
'message': record.getMessage(),
'module': record.module,