aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bachelier <laurent@bachelier.name>2013-04-16 23:22:47 +0200
committerEric S. Raymond <esr@thyrsus.com>2013-04-16 17:35:58 -0400
commit4e6b73bad50627996e76c7efc43bbb48dc6300d8 (patch)
tree0a334cb5d8946f353d74ccd8443656ca251da64f
parentPython 2.5 compatibility (diff)
downloadirker-4e6b73bad50627996e76c7efc43bbb48dc6300d8.tar.xz
Do not write to logfile if None
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
-rwxr-xr-xirkerd5
1 files 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."