diff --git a/netlib/tcp.py b/netlib/tcp.py index f6179faa6..2ebfae963 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -126,6 +126,9 @@ class _FileLike(object): if self.is_logging(): self._log.append(v) + def clear_log(self): + self._log = [] + def reset_timestamps(self): self.first_byte_timestamp = None diff --git a/test/test_tcp.py b/test/test_tcp.py index 14ba555d5..362ba0f40 100644 --- a/test/test_tcp.py +++ b/test/test_tcp.py @@ -553,6 +553,8 @@ class TestFileLike: assert s.get_log() == "" s.read(1) assert s.get_log() == "o" + s.clear_log() + assert s.get_log() == "" s.stop_log() tutils.raises(ValueError, s.get_log)