Support for on_moved handler on file/log monitor backends
This commit is contained in:
parent
0a4cadba3e
commit
3ce98305f0
2 changed files with 6 additions and 0 deletions
|
@ -25,6 +25,9 @@ class EventHandler(FileSystemEventHandler):
|
||||||
def on_modified(self, event):
|
def on_modified(self, event):
|
||||||
get_bus().post(FileSystemModifyEvent(path=event.src_path, is_directory=event.is_directory))
|
get_bus().post(FileSystemModifyEvent(path=event.src_path, is_directory=event.is_directory))
|
||||||
|
|
||||||
|
def on_moved(self, event):
|
||||||
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_resource(cls, resource: MonitoredResource):
|
def from_resource(cls, resource: MonitoredResource):
|
||||||
if isinstance(resource, MonitoredPattern):
|
if isinstance(resource, MonitoredPattern):
|
||||||
|
|
|
@ -50,6 +50,9 @@ class LogEventHandler(EventHandler):
|
||||||
def on_deleted(self, event):
|
def on_deleted(self, event):
|
||||||
self._reset_file(event.src_path)
|
self._reset_file(event.src_path)
|
||||||
|
|
||||||
|
def on_moved(self, event):
|
||||||
|
self._reset_file(event.src_path)
|
||||||
|
|
||||||
def _reset_file(self, path: str):
|
def _reset_file(self, path: str):
|
||||||
file_info = self._monitored_files.get(path)
|
file_info = self._monitored_files.get(path)
|
||||||
if not file_info:
|
if not file_info:
|
||||||
|
|
Loading…
Reference in a new issue