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