-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·48 lines (35 loc) · 1.21 KB
/
main.py
File metadata and controls
executable file
·48 lines (35 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/python -O
import os, logging, logging.config
logging.config.fileConfig("logging.conf")
main_log = logging.getLogger("main_log")
main_log.info("udpLogs daemon starting up")
from eventhandler import EventHandler,eventhandler
config = {'basedir':'/home/devicenull/source/udpLogs'}
main_log.info("Loading events...")
eventcount = 0
for root, dirs, files in os.walk(os.path.join(config['basedir'],"events")):
for cur in files:
if cur[-3:] != ".py":
continue
curevent = cur[:-3]
main_log.debug("Loading event %s" % curevent)
__import__("events.%s" % curevent,globals())
eventcount += 1
main_log.info("Loaded %i events!" % eventcount)
main_log.info("Loading plugins...")
plugincount = 0
for root, dirs, files in os.walk(os.path.join(config['basedir'],"plugins")):
for cur in files:
if cur[-3:] != ".py":
continue
curplugin = cur[:-3]
main_log.debug("Loading plugin %s" % curplugin)
__import__("plugins.%s" % curplugin,globals())
plugincount += 1
main_log.info("Loaded %i plugins!" % plugincount)
from input.udp import UDPInput
udp = UDPInput(eventhandler,9988)
udp.start()
#from input.file import FileInput
#fs = FileInput(eventhandler,"/home/devicenull/source/udpLogs/logs/test_log")
#fs.start()