aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/log.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-06-08 14:01:04 +1200
committerAldo Cortesi <aldo@nullcube.com>2015-06-08 14:01:04 +1200
commitaf22814bc34ab9521def8d190e555364b93dc8be (patch)
treee4fd578d5575b875bfbebe7bf4889452e99e89b0 /libpathod/log.py
parent7dff8f0dca936a58070f6957ab84ca15aa10076a (diff)
downloadmitmproxy-af22814bc34ab9521def8d190e555364b93dc8be.tar.gz
mitmproxy-af22814bc34ab9521def8d190e555364b93dc8be.tar.bz2
mitmproxy-af22814bc34ab9521def8d190e555364b93dc8be.zip
Revamp error logging somewhat
Diffstat (limited to 'libpathod/log.py')
-rw-r--r--libpathod/log.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/libpathod/log.py b/libpathod/log.py
index 8afb86eb..523f431c 100644
--- a/libpathod/log.py
+++ b/libpathod/log.py
@@ -14,6 +14,7 @@ def write(fp, lines):
)
for i in lines:
fp.write(i)
+ fp.write("\n")
fp.flush()
@@ -44,22 +45,13 @@ class Log:
if rlog:
self("Bytes read:")
self.dump(rlog, self.hex)
- if exc_type == netlib.tcp.NetLibTimeout:
- self("Timeout")
- elif exc_type in (
- netlib.tcp.NetLibDisconnect,
- netlib.http.HttpErrorConnClosed
- ):
- self("Disconnected")
- elif exc_type == netlib.http.HttpError:
- self("HTTP Error: %s" % exc_value.message)
- write(
- self.fp,
- [
- "\n".join(self.lines),
- "\n"
- ]
- )
+ if self.lines:
+ write(
+ self.fp,
+ [
+ "\n".join(self.lines),
+ ]
+ )
if exc_value:
raise exc_value