From af22814bc34ab9521def8d190e555364b93dc8be Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 8 Jun 2015 14:01:04 +1200 Subject: Revamp error logging somewhat --- libpathod/log.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'libpathod/log.py') 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 -- cgit v1.2.3