Skip to content
Snippets Groups Projects
Commit e2e9427e authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Add clear logs script

parent b5c70cc6
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
import os
import sys
from glob import glob
app_folder = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "srv")
sys.path.insert(0, app_folder)
from config_reader import AppConfigReader
config = AppConfigReader()
if hasattr(config, "log_dir"):
log_files = glob(os.path.join(config.log_dir, "*.log"))
for file in log_files:
os.remove(file)
else:
print("No log dir defined!")
......@@ -27,7 +27,10 @@ class AppConfigReader:
for attr in dir(self):
attr_o = getattr(self, attr)
if attr.startswith("get_") and callable(attr_o):
setattr(self, attr[4:], attr_o())
try:
setattr(self, attr[4:], attr_o())
except:
pass
@staticmethod
def replace_vars(path):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment