fix: use valid notification fallback log level

Co-authored-by: jokob-sk <96159884+jokob-sk@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]andjokob-sk authored and GitHub committed 2026-08-14 23:51:15 +00:00
1 parent 44ed53cb69
commit 13da2ddbf1
3 files changed
+8 -2

No files matched your search

+1
View File
@@ -24,6 +24,7 @@ description: NetAlertX coding standards and conventions. Use this when writing c
- follow existing code style and structure, and ensure backward compatibility with existing installations when submitting PRs
- all code needs to be scalable to handle large networks with thousands of devices (10k+) without performance degradation
- no inline imports, all imports must be at the top of the file
- when using `server/logger.py` `mylog()`, only use valid levels: `none`, `minimal`, `verbose`, `debug`, `trace`; invalid levels silently degrade to `none`
## File Length
+1 -1
View File
@@ -421,7 +421,7 @@ def finalize_html(mail_html, preheaders):
)
except XMLTokenError as err:
mylog(
"warn",
"none",
f"[Notification] Failed to pretty-print HTML report, sending unindented HTML instead: {err}",
)
return mail_html
+6 -1
View File
@@ -334,8 +334,9 @@ class TestConstructNotificationsTemplates(unittest.TestCase):
# -----------------------------------------------------------------
# Final HTML escapes preheaders and tolerates indent failures
# -----------------------------------------------------------------
@patch("models.notification_instance.mylog")
@patch("models.notification_instance.indent")
def test_finalize_html_escapes_preheader_and_falls_back(self, mock_indent):
def test_finalize_html_escapes_preheader_and_falls_back(self, mock_indent, mock_mylog):
from models.notification_instance import finalize_html, XMLTokenError
mock_indent.side_effect = XMLTokenError("broken html")
@@ -351,6 +352,10 @@ class TestConstructNotificationsTemplates(unittest.TestCase):
self.assertEqual(final_html, expected_html)
mock_indent.assert_called_once()
mock_mylog.assert_called_once_with(
"none",
"[Notification] Failed to pretty-print HTML report, sending unindented HTML instead: broken html",
)
if __name__ == "__main__":