Skip to content

Commit

Permalink
By appending a UUID to the log file, potential filename duplication c…
Browse files Browse the repository at this point in the history
…an be prevented.
  • Loading branch information
akikuno committed Feb 19, 2025
1 parent 147e3f0 commit 41a8b18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/DAJIN2/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import datetime
import logging
import sys
import uuid
import warnings
from pathlib import Path

Expand All @@ -26,7 +27,7 @@ def emit(self, record):

def get_logfile() -> Path:
current_time = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
return Path(f"DAJIN2_log_{current_time}.txt")
return Path(f"DAJIN2_log_{current_time}_{uuid.uuid4()}.txt")


def set_logging(path_logfile: Path) -> logging.Logger:
Expand Down

0 comments on commit 41a8b18

Please sign in to comment.