trying to fix dleetion of logfiles via analytics page

This commit is contained in:
avollkopf 2023-01-28 16:34:09 +01:00
parent 853920be6d
commit 90f94525be
2 changed files with 9 additions and 3 deletions

View file

@ -1,3 +1,3 @@
__version__ = "4.1.0.rc7" __version__ = "4.1.0.rc8"
__codename__ = "Groundhog Day" __codename__ = "Groundhog Day"

View file

@ -181,12 +181,18 @@ class LogController:
def clear_log(self, name:str ) -> str: def clear_log(self, name:str ) -> str:
all_filenames = glob.glob(os.path.join(self.logsFolderPath, f"sensor_{name}.log*")) all_filenames = glob.glob(os.path.join(self.logsFolderPath, f"sensor_{name}.log*"))
for f in all_filenames:
os.remove(f)
if name in self.datalogger: if name in self.datalogger:
self.datalogger[name].removeHandler(self.datalogger[name].handlers[0])
del self.datalogger[name] del self.datalogger[name]
for f in all_filenames:
try:
os.remove(f)
except Exception as e:
logging.warning(e)
def get_all_zip_file_names(self, name: str) -> list: def get_all_zip_file_names(self, name: str) -> list: