Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions can/io/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,17 @@ def on_message_received(self, msg: Message) -> None:
self.writer.on_message_received(msg)

def _get_new_writer(self, filename: StringPathLike) -> FileIOMessageWriter:
"""Instantiate a new writer after stopping the old one.
"""Instantiate a new writer.

.. note::
The :attr:`self.writer` should be closed prior to calling this function.

:param filename:
Path-like object that specifies the location and name of the log file.
The log file format is defined by the suffix of `filename`.
:return:
An instance of a writer class.
"""
# Close the old writer first
if self._writer is not None:
self._writer.stop()

logger = Logger(filename, *self.writer_args, **self.writer_kwargs)
if isinstance(logger, FileIOMessageWriter):
Expand Down