我使用看门狗来查看日志的更改,但我无法从看门狗 API 参考中获取附加内容。还有其他方法可以实现这一点吗?
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import time
import os
class MyHandler(FileSystemEventHandler):
def on_modified(self, event):
if event.src_path == ".\\test.log":
# how to get append content from the log
if __name__ == "__main__":
event_handler = MyHandler()
observer = Observer()
observer.schedule(event_handler, path='.', recursive=False)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
LEATH
相关分类