1

我是看门狗的第一次用户。我想知道看门狗如何处理多个处理程序。会不会是这样的:

if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO,
                        format='%(asctime)s - %(message)s',
                        datefmt='%Y-%m-%d %H:%M:%S')
    path = sys.argv[1] if len(sys.argv) > 1 else '.'
    event_handler_1 = LoggingEventHandler()
    **event_handler_2 = LoggingEventHandler()**
    observer = Observer()
    observer.schedule(event_handler_1, path, recursive=True)
    **observer.schedule(event_handler_2, path, recursive=True)**
    observer.start()
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()
    observer.join()

将不胜感激这方面的帮助

4

0 回答 0