Experiment log stream, to console, file and UI #44

Merged
0950726 merged 4 commits from feat/experiment-logging into dev 2026-01-26 13:39:59 +00:00
Showing only changes of commit a74ecc6c45 - Show all commits

View File

@@ -12,12 +12,21 @@ class DatedFileHandler(FileHandler):
super().__init__(**kwargs)
def _make_filename(self) -> str:
"""
Create the filename for the current logfile, using the configured file prefix and the
current date and time. If the directory does not exist, it gets created.
:return: A filepath.
"""
filepath = Path(f"{self._file_prefix}-{datetime.now():%Y%m%d-%H%M%S}.log")
if not filepath.parent.is_dir():
filepath.parent.mkdir(parents=True, exist_ok=True)
return str(filepath)
def do_rollover(self):
"""
Close the current logfile and create a new one with the current date and time.
"""
self.acquire()
try:
if self.stream: