Add live logs tab to network diagnostics#2333
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a live “Logs” tab to the Network Diagnostics dialog that tails the active session log, with category filtering and basic syntax highlighting. This is supported by updating the app’s log line format to include Qt logging categories and tracking the active timestamped log path in LogManager.
Changes:
- Emit log lines as
[time] LVL category: messageand record the active session log file path inLogManager. - Add a Logs tab to
NetworkDiagnosticsDialogthat tails the active log file, supports category filters, and provides a Live/Paused follow mode. - Extend
LogManagercategory metadata (labels/descriptions) and add missing categories (e.g., MQTT, Propagation).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.cpp | Includes the Qt log category in each log line and registers the active log file path with LogManager. |
| src/gui/NetworkDiagnosticsDialog.h | Declares log tailing/view state, filtering structures, and helper methods for the Logs tab. |
| src/gui/NetworkDiagnosticsDialog.cpp | Implements Logs tab UI, syntax highlighting, category filtering, and file tail/reopen logic. |
| src/core/LogManager.h | Adds API/state to track the active session log file path. |
| src/core/LogManager.cpp | Adds/updates category metadata and returns active log path when set. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| static const char* labels[] = {"DBG", "WRN", "CRT", "FTL", "INF"}; | ||
| const char* label = (type <= QtInfoMsg) ? labels[type] : "???"; |
There was a problem hiding this comment.
Leaving this unchanged. Qt6 preserves the Qt5 enum ordering and assigns QtInfoMsg value 4, so the current lookup {DBG, WRN, CRT, FTL, INF} maps the concrete enum values correctly: Debug=0, Warning=1, Critical=2, Fatal=3, Info=4. The Logs tab highlighter matches the emitted text tokens directly, so it is not affected by enum ordering.
| if (!m_logFile.open(QIODevice::ReadOnly | QIODevice::Text)) { | ||
| addLogLine(QString("[--:--:--.---] WRN default: Unable to open log file: %1").arg(logPath)); | ||
| return false; |
There was a problem hiding this comment.
Addressed in 92349d3. reopenLogFile() now tracks the last failing log path and only emits the "Unable to open log file" warning once per failure state, clearing that suppression after a successful reopen. That keeps the 500 ms tail timer from repeatedly appending the same warning while the path is unavailable.
|
Hi @rfoust — thanks for the contribution! Quick triage of the CI status: CI failure is infrastructure, not your codeThe only red check on The substantive jobs ( On the Copilot review comments
Copilot is mistaken here, and you can safely ignore that one. Qt6's
Your
This one's a legitimate UX concern worth addressing. With Either pattern is fine — the first is the smaller diff. Suggested next stepOnce Appreciate you putting the time into this! |
2f6be84 to
92349d3
Compare
|
Claude here on Jeremy's behalf — merged via admin squash. Thanks @rfoust — the live Logs tab is going to make so many "what is the radio actually doing" debugging sessions easier. Especially appreciate the LogManager session-path tracking + truncation/reopen handling, that's the kind of detail that turns a flaky tail viewer into a robust one. 73, Jeremy KK7GWY & Claude (AI dev partner) |
Summary
Logging details
Rotation and reset behavior
AetherSDR creates a timestamped log file per app session and prunes old session logs at startup. There is no normal mid-session size-based rotation, but the viewer now handles truncation, clearing, missing files, and active-path changes gracefully by reopening/resetting the tail state instead of getting stuck.
Verification