1
0
Fork 0

Fixing time handling on handover and handling of Filerotate-param in MMDVM.ini

See logtailer.ini
main
Kim Huebel 4 years ago
parent 490977c3db
commit 78fcfb691f

@ -2,6 +2,12 @@
Host=0.0.0.0
Port=5678
# This defines the maximum amount of loglines to be sent on initial opening of the dashboard
MaxLines=500
# Keep this parameter synchrone to Filerotate in YSFReflector.ini - if 0 then False, if 1 then True
Filerotate=True
[MMDVMHost]
Logdir=/mnt/ramdisk/
Prefix=MMDVM

@ -81,7 +81,7 @@ async def view_log(websocket, path):
raise ValueError('Fail to parse URL', format(path))
path = os.path.abspath(parse_result.path)
now = datetime.datetime.now()
now = datetime.datetime.now(datetime.timezone.utc)
year = str(now.year)
month = str(now.month)
if len(month) == 1:
@ -92,9 +92,15 @@ async def view_log(websocket, path):
file_path = ""
if path == "/MMDVM":
file_path = config['MMDVMHost']['Logdir']+config['MMDVMHost']['Prefix']+"-"+year+"-"+month+"-"+day+".log"
if config['DEFAULT']['Filerotate'] == "True":
file_path = config['MMDVMHost']['Logdir']+config['MMDVMHost']['Prefix']+"-"+year+"-"+month+"-"+day+".log"
else:
file_path = config['MMDVMHost']['Logdir']+config['MMDVMHost']['Prefix']+".log"
elif path == "/DAPNET":
file_path = config['DAPNETGateway']['Logdir']+config['DAPNETGateway']['Prefix']+"-"+year+"-"+month+"-"+day+".log"
if config['DEFAULT']['Filerotate'] == "True":
file_path = config['DAPNETGateway']['Logdir']+config['DAPNETGateway']['Prefix']+"-"+year+"-"+month+"-"+day+".log"
else:
file_path = config['DAPNETGateway']['Logdir']+config['DAPNETGateway']['Prefix']+".log"
if path == "/MMDVM" or path == "/DAPNET":
logging.info(file_path)
@ -102,7 +108,7 @@ async def view_log(websocket, path):
raise ValueError('File not found', format(file_path))
with open(file_path, newline = '\n', encoding="utf8", errors='ignore') as f:
content = ''.join(deque(f))
content = ''.join(deque(f, 2))
content = conv.convert(content, full=False)
lines = content.split("\n")
for line in lines:

Loading…
Cancel
Save