author | Tero Marttila <terom@fixme.fi> |
Fri, 05 Feb 2010 21:48:14 +0200 | |
changeset 58 | 31a17b0b5159 |
parent 48 | ba101beeb062 |
child 62 | e4db89a5f6bc |
permissions | -rw-r--r-- |
48
ba101beeb062
work on logwatch docs, small tweaks
Tero Marttila <terom@fixme.fi>
parents:
47
diff
changeset
|
1 |
""" |
ba101beeb062
work on logwatch docs, small tweaks
Tero Marttila <terom@fixme.fi>
parents:
47
diff
changeset
|
2 |
A module that can monitor any number of log files, and then process each incoming line, filtering and then possibly |
ba101beeb062
work on logwatch docs, small tweaks
Tero Marttila <terom@fixme.fi>
parents:
47
diff
changeset
|
3 |
reformatting them before sending out to IRC. |
ba101beeb062
work on logwatch docs, small tweaks
Tero Marttila <terom@fixme.fi>
parents:
47
diff
changeset
|
4 |
""" |
ba101beeb062
work on logwatch docs, small tweaks
Tero Marttila <terom@fixme.fi>
parents:
47
diff
changeset
|
5 |
|
40
b9fdb7710768
move logwatch*.py to separate fixbot.logwatch package, and move logwatch_sources to etc/fixbot-logwatch.py
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
6 |
from fixbot import api |
23
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
7 |
|
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
8 |
class LogWatchModule (api.Module) : |
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
9 |
name = "logs" |
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
10 |
|
40
b9fdb7710768
move logwatch*.py to separate fixbot.logwatch package, and move logwatch_sources to etc/fixbot-logwatch.py
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
11 |
def __init__ (self, config) : |
b9fdb7710768
move logwatch*.py to separate fixbot.logwatch package, and move logwatch_sources to etc/fixbot-logwatch.py
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
12 |
""" |
b9fdb7710768
move logwatch*.py to separate fixbot.logwatch package, and move logwatch_sources to etc/fixbot-logwatch.py
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
13 |
Initialize with logwatch_sources from config |
b9fdb7710768
move logwatch*.py to separate fixbot.logwatch package, and move logwatch_sources to etc/fixbot-logwatch.py
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
14 |
""" |
b9fdb7710768
move logwatch*.py to separate fixbot.logwatch package, and move logwatch_sources to etc/fixbot-logwatch.py
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
15 |
|
b9fdb7710768
move logwatch*.py to separate fixbot.logwatch package, and move logwatch_sources to etc/fixbot-logwatch.py
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
16 |
super(LogWatchModule, self).__init__(config) |
b9fdb7710768
move logwatch*.py to separate fixbot.logwatch package, and move logwatch_sources to etc/fixbot-logwatch.py
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
17 |
|
b9fdb7710768
move logwatch*.py to separate fixbot.logwatch package, and move logwatch_sources to etc/fixbot-logwatch.py
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
18 |
self.sources = config['logwatch-sources'] |
23
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
19 |
|
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
20 |
def handleConnect (self) : |
48
ba101beeb062
work on logwatch docs, small tweaks
Tero Marttila <terom@fixme.fi>
parents:
47
diff
changeset
|
21 |
""" |
ba101beeb062
work on logwatch docs, small tweaks
Tero Marttila <terom@fixme.fi>
parents:
47
diff
changeset
|
22 |
Initialize each source |
ba101beeb062
work on logwatch docs, small tweaks
Tero Marttila <terom@fixme.fi>
parents:
47
diff
changeset
|
23 |
""" |
ba101beeb062
work on logwatch docs, small tweaks
Tero Marttila <terom@fixme.fi>
parents:
47
diff
changeset
|
24 |
|
40
b9fdb7710768
move logwatch*.py to separate fixbot.logwatch package, and move logwatch_sources to etc/fixbot-logwatch.py
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
25 |
for source in self.sources : |
23
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
26 |
source.setModule(self) |
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
27 |
|
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
28 |
def error (self, msg) : |
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
29 |
self.sendEvent("error", msg) |
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
30 |
|
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
31 |
def makeService (config) : |
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
32 |
return api.makeService(LogWatchModule, config) |
67e71e9170e5
rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff
changeset
|
33 |