def __init__(self,MainDaemon): ModuleTemplate.__init__(self,MainDaemon) #config variables init self.LOG_DB = self.getConfigVar("LOG_DB") self.LOG_DB = self.LOG_DB.replace("~~HOME~~", appendProjectPath()) self.LOG_RESOLUTION = int(self.getConfigVar("LOG_RESOLUTION")) self.engine = create_engine(self.LOG_DB) self.InitDB() return
from collections import OrderedDict from common.common import appendProjectPath import json config = SafeConfigParser() import os.path, sys ETC_DIR= os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])),'..',"etc") config.read(os.path.join(ETC_DIR,"config.ini")) LOG_DB = config.get('plugins.Logger', 'LOG_DB') LOG_DB = LOG_DB.replace("~~HOME~~", appendProjectPath()) #Import database structure from plugins.Log import Log class Reader(): def __init__(self): self.LOG_DB = LOG_DB self.Log = Log print self.LOG_DB self.engine = create_engine(self.LOG_DB) return def getDBInfo(self,server,fromTime,toTime): ''' Get the data information from the log between a given timeframe @return: A table with the results
config,ETC_DIR = loadConfig() PLUGIN_DIR = "plugins" try: PLUGIN_DIR =config.get('main', 'PLUGIN_DIR') except: pass LOG_FILE_PATH = "log.txt" try: LOG_FILE_PATH = appendProjectPath(config.get('main', 'LOG_FILE_PATH')) except: pass pluginList=[] try: pluginList= json.loads(config.get("plugins","pluginList")) except: pass class MainDaemon(object): ''' The Main Daemon runs the Ockle Core, and controls the Server network, It loads the plugins which decide what the network behavior should be''' def debug(self,message): self.f = codecs.open(LOG_FILE_PATH,'a')