Development

This commit is contained in:
Matthew Grotke 2026-05-23 16:55:48 -04:00
parent b8f1e5f980
commit 4a24c71d87

View file

@ -465,6 +465,7 @@ DDNS_LOG_MAX = 50
def _ddns_log_tail():
log_path = f'{CONFIGS_DIR}/ddns.log'
try:
size_kb = os.path.getsize(log_path) / 1024
with open(log_path) as f:
lines = f.readlines()
if not lines:
@ -473,10 +474,11 @@ def _ddns_log_tail():
tail = lines[-DDNS_LOG_MAX:]
shown = len(tail)
hidden = total - shown
size_str = f'{size_kb:.1f}KB'
if hidden > 0:
summary = f'Showing last {shown} lines ({hidden} lines not shown)'
summary = f'Log file size: {size_str}. Showing last {shown} lines ({hidden} lines not shown).'
else:
summary = f'Showing {shown} lines'
summary = f'Log file size: {size_str}. Showing {shown} lines.'
return ''.join(tail).strip(), f'<p class="text-muted" style="margin-top:0.5em;">{summary}</p>'
except FileNotFoundError:
return '(log file not found)', ''