From 178b0b506e1ba198945c69e6ef0a2e83a122770c Mon Sep 17 00:00:00 2001 From: Jonathan Harris <jonathan@marginal.org.uk> Date: Tue, 24 Jan 2017 23:25:15 +0000 Subject: [PATCH] Ignore backups of edited Journal files --- monitor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monitor.py b/monitor.py index b7206ba1..53a96944 100644 --- a/monitor.py +++ b/monitor.py @@ -165,7 +165,7 @@ class EDLogs(FileSystemEventHandler): def on_created(self, event): # watchdog callback, e.g. client (re)started. - if not event.is_directory and basename(event.src_path).startswith('Journal.'): + if not event.is_directory and basename(event.src_path).startswith('Journal.') and basename(event.src_path).endswith('.log'): self.logfile = event.src_path def worker(self): @@ -197,7 +197,7 @@ class EDLogs(FileSystemEventHandler): else: # Poll try: - logfiles = sorted([x for x in listdir(self.currentdir) if x.startswith('Journal.')]) + logfiles = sorted([x for x in listdir(self.currentdir) if x.startswith('Journal.') and x.endswith('.log')]) newlogfile = logfiles and join(self.currentdir, logfiles[-1]) or None except: if __debug__: print_exc()