equal
deleted
inserted
replaced
1 from twisted.internet import protocol, reactor |
|
2 from twisted.python import log |
|
3 import sys |
|
4 |
|
5 from fixbot import api |
|
6 |
|
7 class LogWatchModule (api.Module) : |
|
8 name = "logs" |
|
9 version = 0x0005 |
|
10 |
|
11 event_types = [ |
|
12 "error", |
|
13 "sudo", |
|
14 "ssh", |
|
15 "all" |
|
16 ] |
|
17 |
|
18 def __init__ (self, config) : |
|
19 """ |
|
20 Initialize with logwatch_sources from config |
|
21 """ |
|
22 |
|
23 super(LogWatchModule, self).__init__(config) |
|
24 |
|
25 self.sources = config['logwatch-sources'] |
|
26 |
|
27 def handleConnect (self) : |
|
28 for source in self.sources : |
|
29 source.setModule(self) |
|
30 |
|
31 def error (self, msg) : |
|
32 self.sendEvent("error", msg) |
|
33 |
|
34 def makeService (config) : |
|
35 return api.makeService(LogWatchModule, config) |
|
36 |
|