FileSystemMonitor.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:File-System-Monitor 作者: codeson007 项目源码 文件源码
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)+"'}")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号