diff -r e82b6df5baa3 -r b9fdb7710768 fixbot/logwatch/logwatch.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fixbot/logwatch/logwatch.py Thu Feb 04 19:40:51 2010 +0200 @@ -0,0 +1,36 @@ +from twisted.internet import protocol, reactor +from twisted.python import log +import sys + +from fixbot import api + +class LogWatchModule (api.Module) : + name = "logs" + version = 0x0005 + + event_types = [ + "error", + "sudo", + "ssh", + "all" + ] + + def __init__ (self, config) : + """ + Initialize with logwatch_sources from config + """ + + super(LogWatchModule, self).__init__(config) + + self.sources = config['logwatch-sources'] + + def handleConnect (self) : + for source in self.sources : + source.setModule(self) + + def error (self, msg) : + self.sendEvent("error", msg) + +def makeService (config) : + return api.makeService(LogWatchModule, config) +