def startMonitor(mpath,plugin_path,logger,log_file,objClass):
"""
?????
mpath?????
plugin_path,????
log_file,??????
objClass?????
"""
t_str = time.strftime('%Y%m%d%H%M%S')
logger.info("service is started !!!!")
logger.info("monitor path :" + mpath)
logger.info("plugin path :" + plugin_path)
logger.info("log file :" + log_file)
logger.info(" base class of plugin :" + str(objClass))
try :
observer = Observer()
event_handler = FileEventHandler(mpath,plugin_path,logger,log_file,objClass)
observer.schedule(event_handler,mpath,True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt,e:
observer.stop()
logger.error("{'time':'"+t_str+"','module':'FileSystemMonitor','class':'None','method':'startMonitor' ,'errors':'" +str(e)+"'}")
observer.join()
except Exception,e :
logger.error("{'time':'"+t_str+"','module':'FileSystemMonitor','class':'None','method':'startMonitor' ,'errors':'" +str(e)+"'}")
FileSystemMonitor.py 文件源码
python
阅读 16
收藏 0
点赞 0
评论 0
评论列表
文章目录