feat: view full log line in monit dashboard - #6137
Open
ButchAnton wants to merge 1 commit into
Open
Conversation
The Logs panel in `pm2 monit`/`pm2 dashboard` renders each entry as one row in a blessed list, so anything wider than the panel is silently clipped with no way to see the rest - no wrapping, no horizontal scroll, no detail view. This adds one: pressing Enter on a selected line in the Logs panel opens a scrollable overlay with the full, wrapped, untruncated text, plus a bit of parsed context - process name, stream (stdout/stderr/pm2 internal), when the dashboard received it, and a best-effort detected timestamp/log level pulled from the line's own text (many apps prefix their own log lines with these, independent of pm2's stream typing). Enter again closes the overlay. Implementation notes: - A parallel `rawLogLines` buffer stores untruncated text + metadata per line, evicted in lockstep with the existing `logLines` (display strings) buffer, so memory usage is unaffected. - The overlay listens for List's `select` event (emitted only from `enterSelected`, i.e. Enter), not `select item` (emitted on every navigation via `List.prototype.select`, including the refresh-driven `setItems()` calls) - so it only opens on an explicit Enter press, never as a side effect of scrolling or the dashboard's periodic refresh. - Log text coming through loggers like Winston can carry raw ANSI SGR codes around level words (e.g. "\x1b[32minfo\x1b[39m:"). Left in place, the escape sequence's trailing letter sits directly against the word with no regex word boundary between them, silently breaking level detection - so these are stripped before storage. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Logs panel in
pm2 monit/pm2 dashboard(lib/API/Dashboard.js)renders each entry as one row in a
blessed.list. Anything wider than thepanel is silently clipped, with no way to see the rest — no wrapping, no
horizontal scroll, no detail view. Long lines (stack traces, JSON payloads,
long URLs, etc.) are simply unreadable in the dashboard today.
What this adds
Pressing Enter on a selected line in the Logs panel opens a scrollable
overlay with:
stdout/stderr/ pm2-internal)own text (many apps prefix their own lines with these, independent of
pm2's stream typing)
Pressing Enter again closes the overlay and returns focus to the Logs panel.
The footer hint text is updated accordingly.
Implementation notes
rawLogLinesbuffer stores untruncated text + metadata perline, evicted in lockstep with the existing
logLines(display strings)buffer, so memory usage is unaffected.
List'sselectevent (emitted only fromenterSelected, i.e. an explicit Enter), notselect item(emitted onevery navigation via
List.prototype.select, including the refresh-drivensetItems()calls) — so it only opens on Enter, never as a side effect ofscrolling or the dashboard's periodic refresh tick.
around level words (e.g.
"\x1b[32minfo\x1b[39m:"). Left in place, theescape sequence's trailing letter sits directly against the word with no
regex word boundary between them, silently breaking level detection — so
these are stripped before storage.
Testing
This file has no existing automated test coverage (it's a
blessedterminal UI with no headless test harness in this repo). I tested manually
via
tmux(driving the real interactive dashboard withtmux send-keys/capture-paneagainst livepm2-managed processes) and via a smallsynthetic harness that calls
Dashboard.init()/.log()/.showLogDetail()directly to exercise ANSI-stripping and level-detectionagainst realistic Winston-colorized output. Verified:
panel
input
(Escape/q/Ctrl-C) behavior
Made with Cursor