From 4e6b73bad50627996e76c7efc43bbb48dc6300d8 Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Tue, 16 Apr 2013 23:22:47 +0200 Subject: [PATCH] Do not write to logfile if None Signed-off-by: Eric S. Raymond --- irkerd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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." -- 2.26.2