Skip to content

Commit bc53318

Browse files
FabianClemenzlnagel
authored andcommitted
add support for Python 3.12 in setup, fix deprecation warning
1 parent f2b06cd commit bc53318

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

django_datadog_logger/formatters/datadog.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
import typing
55
from logging import LogRecord
66

7-
try:
8-
import zoneinfo
9-
except ImportError:
10-
from backports import zoneinfo
11-
127
import json_log_formatter
138
from django.conf import settings
149
from django.core.exceptions import DisallowedHost
@@ -82,7 +77,7 @@ def json_record(self, message: str, extra: typing.Dict, record: LogRecord) -> ty
8277
"logger.thread_name": record.threadName,
8378
"logger.method_name": record.funcName,
8479
"date": (
85-
datetime.datetime.utcfromtimestamp(record.created).replace(tzinfo=zoneinfo.ZoneInfo("UTC")).isoformat()
80+
datetime.datetime.fromtimestamp(record.created, tz=datetime.UTC).isoformat()
8681
),
8782
"status": record.levelname,
8883
}

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"Programming Language :: Python :: 3.9",
3737
"Programming Language :: Python :: 3.10",
3838
"Programming Language :: Python :: 3.11",
39+
"Programming Language :: Python :: 3.12",
3940
],
4041
description="Django DataDog Logger integration package.",
4142
install_requires=requirements,

0 commit comments

Comments
 (0)