Skip to content

Add live logs tab to network diagnostics#2333

Merged
ten9876 merged 1 commit intoten9876:mainfrom
rfoust:codex/network-diagnostics-logs
May 4, 2026
Merged

Add live logs tab to network diagnostics#2333
ten9876 merged 1 commit intoten9876:mainfrom
rfoust:codex/network-diagnostics-logs

Conversation

@rfoust
Copy link
Copy Markdown
Contributor

@rfoust rfoust commented May 4, 2026

Summary

  • Add a final Logs tab to the Network Diagnostics window that tails the active local AetherSDR log in real time.
  • Add category filters backed by LogManager categories, including Select All / Deselect All controls and category IDs in tooltips.
  • Add syntax highlighting for timestamps, levels, categories, numeric values, and common protocol/network tokens.
  • Add a single Live/Paused toggle: scrolling back or toggling off freezes the visible output while buffering new lines; toggling Live rebuilds the filtered view and returns to the latest output.
  • Hide the Timeframe selector while the Logs tab is selected without resetting the selected timeframe.

Logging details

  • Include the Qt logging category in each app log line so the Logs tab can filter accurately: [time] LVL category: message.
  • Track the active timestamped session log path in LogManager instead of relying on the aethersdr.log symlink/shortcut path.
  • Expose missing registered categories in LogManager: MQTT and Propagation.
  • Clarify the existing command/status labels: Connection / Commands maps to aether.connection raw TX/RX/socket logs; Protocol / Status maps to aether.protocol parsed protocol/model status handling.

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

  • Verified every Q_LOGGING_CATEGORY-defined aether.* category has a matching filter category; missing: none, extra: none.
  • Built successfully with: cmake --build /private/tmp/AetherSDR-network-logs-build -j 6

Copilot AI review requested due to automatic review settings May 4, 2026 03:07
@rfoust rfoust requested review from jensenpat and ten9876 as code owners May 4, 2026 03:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: message and record the active session log file path in LogManager.
  • Add a Logs tab to NetworkDiagnosticsDialog that tails the active log file, supports category filters, and provides a Live/Paused follow mode.
  • Extend LogManager category 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.

Comment thread src/main.cpp
Comment on lines 115 to 116
static const char* labels[] = {"DBG", "WRN", "CRT", "FTL", "INF"};
const char* label = (type <= QtInfoMsg) ? labels[type] : "???";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +1195 to +1197
if (!m_logFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
addLogLine(QString("[--:--:--.---] WRN default: Unable to open log file: %1").arg(logPath));
return false;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@aethersdr-agent
Copy link
Copy Markdown
Contributor

Hi @rfoust — thanks for the contribution! Quick triage of the CI status:

CI failure is infrastructure, not your code

The only red check on 2f6be84 is Cleanup artifactsDelete artifacts, which runs after the build and just calls gh to garbage-collect the upload artifacts via the GitHub API. That step failing is unrelated to anything in your diff — it's almost always a transient API/permissions hiccup on our side and will clear on the next push or re-run. Nothing to fix on your end for that one.

The substantive jobs (build, analyze (cpp)) were still in_progress at snapshot time, so please keep an eye on those — that's where any real signal will show up.

On the Copilot review comments

src/main.cpp:116 — QtMsgType ordering

Copilot is mistaken here, and you can safely ignore that one. Qt6's QtMsgType enum is not (Debug, Info, Warning, Critical, Fatal)QtInfoMsg was added later and assigned value 4 specifically to preserve ABI compatibility with Qt5 (Qt docs). So the actual values are:

Enum Value
QtDebugMsg 0
QtWarningMsg 1
QtCriticalMsg 2
QtFatalMsg 3
QtInfoMsg 4

Your labels[] = {"DBG", "WRN", "CRT", "FTL", "INF"} indexes those exactly right, and the (type <= QtInfoMsg) guard correctly admits all five. The new DBG|INF|WRN|CRT|FTL highlighter regex in NetworkDiagnosticsDialog.cpp matches by literal token, not enum order, so it's also fine. No change needed.

src/gui/NetworkDiagnosticsDialog.cpp:1197reopenLogFile() spam

This one's a legitimate UX concern worth addressing. With appendNewLogData() running every 500 ms and calling reopenLogFile(true) on a missing file, a transient bad path will spam the viewer (and grow m_logLines unboundedly) at 2 lines/sec. A small fix that fits the surrounding code: track the last-emitted failure path in a member (e.g. QString m_lastReopenFailurePath) and only emit when it changes, resetting on successful open. Alternatively, stop m_logRefreshTimer on failure and re-arm with a longer interval until the file reappears.

Either pattern is fine — the first is the smaller diff.

Suggested next step

Once build and analyze (cpp) finish, if those are green, the only remaining red is the artifact-cleanup job, which a maintainer can ignore or re-run. Ping me here if either of the still-running checks comes back failing and I'll dig in.

Appreciate you putting the time into this!

@rfoust rfoust force-pushed the codex/network-diagnostics-logs branch from 2f6be84 to 92349d3 Compare May 4, 2026 03:19
@ten9876 ten9876 merged commit a75e894 into ten9876:main May 4, 2026
4 checks passed
@ten9876
Copy link
Copy Markdown
Owner

ten9876 commented May 4, 2026

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants