--- a/fixbot/logwatch/sources.py Sat Nov 06 16:01:42 2010 +0200
+++ b/fixbot/logwatch/sources.py Sat Nov 06 16:02:28 2010 +0200
@@ -5,8 +5,7 @@
from twisted.internet import protocol, reactor
from twisted.python import log
-from fixbot import fifo
-from fixbot.logwatch import message
+from fixbot.logwatch import fifo, message
class LogSource (object) :
"""
@@ -38,6 +37,13 @@
log.err(msg)
self.module.error(msg)
+ def connectionLost (self, reason) :
+ """
+ The transport we were connected to has dropped, possibly as a result of our handlers raising an error?
+ """
+
+ self.handleError("lost LogSource for %s: %s" % (self.name, reason.getErrorMessage()))
+
def handleData (self, data) :
"""
Feed binary data into the buffer, processing all lines via handleLine()
@@ -110,6 +116,9 @@
else :
raise ValueError(out)
+ def logPrefix (self) :
+ return "LogSource(%s)" % (self.name, )
+
class File (LogSource, protocol.ProcessProtocol) :
"""
Stream lines from a regular file using /usr/bin/tail -f
@@ -150,11 +159,7 @@
def handleEOF (self) :
self.handleError("!!! EOF on fifo %s, re-opening" % self.name)
- self.reopen()
-
- def connectionLost (self, reason) :
- super(Fifo, self).connectionLost(reason)
- self.handleError("lost fifo for %s: %s" % (self.name, reason.getErrorMessage()))
+ self.reopen()
class UnixDatagramSocket (LogSource, protocol.DatagramProtocol) :
"""
@@ -181,6 +186,4 @@
# handle it as a line of data
self.handleLine(data)
- def logPrefix (self) :
- return "LogSource(%s)" % (self.name, )