From: Laurent Bachelier Date: Tue, 16 Apr 2013 21:22:47 +0000 (+0200) Subject: Do not write to logfile if None X-Git-Tag: 1.18~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4e6b73bad50627996e76c7efc43bbb48dc6300d8;p=irker.git Do not write to logfile if None Signed-off-by: Eric S. Raymond --- diff --git a/irkerd b/irkerd index 7a6256e..ca0d617 100755 --- a/irkerd +++ b/irkerd @@ -479,8 +479,9 @@ class Irker: connection.context.handle_kick(target) def _handle_all_raw_messages(self, _connection, event): "Log all messages when in watcher mode." - with open(logfile, "a") as logfp: - logfp.write("%03f|%s|%s\n" % \ + if logfile: + with open(logfile, "a") as logfp: + logfp.write("%03f|%s|%s\n" % \ (time.time(), event.source, event.arguments[0])) def handle(self, line): "Perform a JSON relay request."