Skip to content

Commit 42fa349

Browse files
committed
no miliseconds in logging
1 parent 7fad25f commit 42fa349

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/torchrunx/utils/logging.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Utilities for intercepting logs in worker processes and handling these in the Launcher."""
1+
"""Utilities for intercepting logs in worker processes and handling these in the Launcher.""" # noqa: A005
22

33
from __future__ import annotations
44

@@ -75,6 +75,7 @@ def stream_handler(
7575
"%(asctime)s:%(levelname)s:%(hostname)s[%(local_rank)s]: %(message)s"
7676
if local_rank is not None
7777
else "%(asctime)s:%(levelname)s:%(hostname)s: %(message)s",
78+
datefmt="%Y-%m-%d %H:%M:%S",
7879
),
7980
)
8081
return handler
@@ -89,8 +90,9 @@ def file_handler(
8990
"""Handler builder function for writing logs from specified hostname/rank to a file."""
9091
handler = logging.FileHandler(file_path)
9192
add_filter_to_handler(handler, hostname, local_rank, log_level=log_level)
92-
formatter = logging.Formatter("%(asctime)s:%(levelname)s: %(message)s")
93-
handler.setFormatter(formatter)
93+
handler.setFormatter(
94+
logging.Formatter("%(asctime)s:%(levelname)s: %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
95+
)
9496
return handler
9597

9698

0 commit comments

Comments
 (0)