"""
A module that can monitor any number of log files, and then process each incoming line, filtering and then possibly
reformatting them before sending out to IRC.
"""
from fixbot import api
class LogWatchModule (api.Module) :
name = "logs"
def __init__ (self, config) :
"""
Initialize with logwatch_sources from config
"""
super(LogWatchModule, self).__init__(config)
self.sources = config['logwatch-sources']
def handleConnect (self) :
"""
Initialize each source
"""
for source in self.sources :
source.setModule(self)
def error (self, msg) :
self.sendEvent("error", msg)
def makeService (config) :
return api.makeService(LogWatchModule, config)