Skip to content

feat(settings): show the server log in This instance / Logs - #36

Merged
Digit4w merged 3 commits into
devfrom
feat/diagnostic-logs
Sep 14, 2026
Merged

Digit4w merged 3 commits into
devfrom
feat/diagnostic-logs

Conversation

@Digit4w

@Digit4w Digit4w commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner

Contraparte: Digit4w/watchpile-server#25 — mergear aquele primeiro.

The admin can now read what the server has been doing and hand it to whoever is helping: a new THIS INSTANCE / Logs section between Storage and Updates, drawn from a recorte mockup and checked in the running app.

  • Level as a short label (only ERROR and WARN get colour), mono lines that wrap inside the message column, local time with day separators, stack behind Show details.
  • All · Warnings · Errors in the URL, cumulative. Copy takes the visible lines as text; Download takes every file as JSON Lines.
  • Follows new lines only while scrolled to the end; scrolled up, a "N new lines" piece jumps back. Load older keeps the reading position (0px drift, measured in the browser).
  • SettingsShell gets fill so only the viewer scrolls.

Needs the server PR first — the section calls /api/logs.

Known gap: Copy uses navigator.clipboard, which only exists in a secure context. On http://hermes.local (plain HTTP on the LAN) it falls into "Couldn't copy"; Download works everywhere. Registered in the handoff as a decision to make.

🤖 Generated with Claude Code

A new admin section between Storage and Updates reads GET /api/logs,
drawn from a recorte mockup the same day.

- Lines: local HH:MM:SS, level as a short label (only ERROR and
  WARN get colour), message in ink, fields as key=value, stack
  behind Show details. Mono 12px, wrapping inside the message
  column, day separators when the date turns.
- All / Warnings / Errors live in the URL (?level=) and are
  cumulative. Filtering to nothing offers Show all.
- Copy takes the lines on screen as readable text and says Copied
  in place; Download is an <a href download> to the JSON Lines file.
- Follows new lines only while scrolled to the end; otherwise a
  glass 'N new lines' piece jumps back. Load older prepends and
  keeps the reading position anchored to the end.
- SettingsShell gets `fill`, so the viewer takes the height that is
  left and only it scrolls. Other sections do not pass it.
- domain/log-view.ts holds the pure rules, with specs; the section
  has a component spec cut at services/.
Load older prepends lines, and a row key that shifts with that
remounts the whole list, closing any open stack. Two keys got it
wrong, both caught only in the running app:

- the list index as tiebreaker: every row's index shifts when
  lines enter before it;
- time + level + message with the occurrence as tiebreaker: a
  burst has hundreds of "Request completed" in one millisecond,
  and older ones entering first shift the count of the rest.

The key now includes the fields, which is where burst lines differ
(reqId, req.path); the occurrence only separates lines identical
field by field. rowKeys moved to domain/log-view.ts with a spec for
the burst case (it fails without the fields, checked), and the
component spec expects an open stack to survive Load older.

Verified in the browser against the new build: the anchor row node
survives Load older. An earlier check that looked like a failure
was the page still running the cached previous bundle.
Logs joins the section list, and a new section records the URL
filter, SettingsShell fill, follow-at-end, the single layout
effect, row keys with fields, the clipboard secure-context gap and
checking which build is on screen.
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.

1 participant