diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2015-06-05 11:42:06 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2015-06-05 11:42:06 +1200 |
commit | 4ca62e0d9bd09aa286cde9bafceff7204304d00c (patch) | |
tree | 1564f7d50548779ed38f4866fa33bcadc42c412f | |
parent | 113c5c187f0c37ce0c13c399248f4bf91e3a3149 (diff) | |
download | mitmproxy-4ca62e0d9bd09aa286cde9bafceff7204304d00c.tar.gz mitmproxy-4ca62e0d9bd09aa286cde9bafceff7204304d00c.tar.bz2 mitmproxy-4ca62e0d9bd09aa286cde9bafceff7204304d00c.zip |
tcp: clear_log to clear socket logs
-rw-r--r-- | netlib/tcp.py | 3 | ||||
-rw-r--r-- | test/test_tcp.py | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py index f6179faa..2ebfae96 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 14ba555d..362ba0f4 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) |