Skip to content

Commit 37dcfb0

Browse files
authored
fix: use fromtimestamp instead of deprecated utcfromtimestamp (#105)
* fix: use fromtimestamp instead of deprecated utcfromtimestamp * fix: undo version update
1 parent 927235d commit 37dcfb0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ecs_logging/_structlog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def format_to_ecs(self, event_dict):
4242
# type: (Dict[str, Any]) -> Dict[str, Any]
4343
if "@timestamp" not in event_dict:
4444
event_dict["@timestamp"] = (
45-
datetime.datetime.utcfromtimestamp(time.time()).strftime(
46-
"%Y-%m-%dT%H:%M:%S.%f"
47-
)[:-3]
45+
datetime.datetime.fromtimestamp(
46+
time.time(), tz=datetime.timezone.utc
47+
).strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3]
4848
+ "Z"
4949
)
5050

0 commit comments

Comments
 (0)