Skip to content

Commit bac2bc1

Browse files
committed
refactor: enhance logging of raw router output for better visibility
1 parent d41c703 commit bac2bc1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

hyperglass/plugins/_builtin/trace_route_mikrotik.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,19 @@ def process(self, *, output: "OutputType", query: "Query") -> "OutputDataModel":
130130
# Debug: emit the raw response exactly as returned by the router.
131131
# Do not transform, join, or normalize the output — log it verbatim.
132132
try:
133-
_log.debug("Router raw output", raw=output)
133+
# Ensure the router output is embedded in the log message body so it
134+
# is visible regardless of the logger's formatter configuration.
135+
if isinstance(output, (tuple, list)):
136+
try:
137+
combined_raw = "\n".join(output)
138+
except Exception:
139+
# Fall back to repr if join fails for non-string elements
140+
combined_raw = repr(output)
141+
else:
142+
combined_raw = output if isinstance(output, str) else repr(output)
143+
144+
# Log the full verbatim router response (DEBUG level).
145+
_log.debug("Router raw output:\n{}", combined_raw)
134146
except Exception:
135147
# Don't let logging interfere with normal processing
136148
_log.exception("Failed to log router raw output")

0 commit comments

Comments
 (0)