This commit is contained in:
SpudGunMan
2024-10-03 12:43:03 -07:00
parent a28f51fa55
commit 7f1787e52b
2 changed files with 9 additions and 3 deletions

View File

@@ -12,4 +12,6 @@ Example to log to disk only INFO and higher (ignore DEBUG)
```
*log.py
file_handler.setLevel(logging.INFO) # DEBUG used by default for system logs to disk example here shows INFO
```
```
Reporting is via [logs/mesh_network_analyzer.py](logs/mesh_network_analyzer.py) static log analysis to a HTML report file.

View File

@@ -6,6 +6,10 @@ import json
import platform
import subprocess
# global variables
LOG_PATH = '/opt/meshing-around/logs'
W3_PATH = '/var/www/html'
def parse_log_file(file_path):
with open(file_path, 'r') as file:
lines = file.readlines()
@@ -515,7 +519,7 @@ def generate_hosts_html(system_info):
return template.safe_substitute(system_info)
def main():
log_dir = '/opt/meshing-around/logs'
log_dir = LOG_PATH
today = datetime.now().strftime('%Y_%m_%d')
log_file = f'meshbot{today}.log'
log_path = os.path.join(log_dir, log_file)
@@ -527,7 +531,7 @@ def main():
network_map_html = generate_network_map_html(log_data)
hosts_html = generate_hosts_html(system_info)
output_dir = '/var/www/html'
output_dir = W3_PATH
index_path = os.path.join(output_dir, 'index.html')
try: