From a87ac352012b481b8abe5312cc5736f1acb2c05f Mon Sep 17 00:00:00 2001 From: Twirre Meulenbelt <43213592+TwirreM@users.noreply.github.com> Date: Thu, 22 Jan 2026 11:34:51 +0100 Subject: [PATCH] docs: add docstrings to dated file handler ref: N25B-401 --- src/control_backend/logging/dated_file_handler.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/control_backend/logging/dated_file_handler.py b/src/control_backend/logging/dated_file_handler.py index b927f9d..3a405bb 100644 --- a/src/control_backend/logging/dated_file_handler.py +++ b/src/control_backend/logging/dated_file_handler.py @@ -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: