Add logs (with colour) to web UI #38
Labels
No labels
Bug
BuildIssue
Claude-fixed
Enhancement
In Progress
Low priority
On Hold
Rejected
Security
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
keyop-go/nfq_forwarder#38
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It would be good to be able to view live logs from the web UI, including colourised log entries based on levels.
changed the description
Plan:
internal/log: add a fixed-capacity, overwrite-oldest ring buffer capturing every log record (time/level/message/attrs) as it's handled, wrapping the existing tint handler rather than replacing it - stderr output is unaffected. Exposed vialog.EnableBuffer(capacity)/log.Entries(sinceSeq).web_ui.log_buffer_linesconfig field (default 1000), following the same default/validate pattern as the otherweb_ui.*int fields.setupLoggingenables the buffer only when the web UI itself is enabled - no memory/CPU cost otherwise.GET /logspage +GET /api/logs?since=<seq>endpoint (session-gated, same as every other page) - the frontend polls with a cursor so it only fetches new entries each time, not the whole buffer.levelfield to a CSS class (not by trying to convert tint's ANSI terminal codes to HTML) - cleaner and ties into this project's existing light/dark CSS variables.Will post again once a PR is up.
PR #82 is up, CI green - link: #82
Merged via #82 (merge commit
97ee832), released as v1.2.0 - https://forgejo.keyop.co.uk/keyop-go/nfq_forwarder/releases/tag/v1.2.0 (confirmed real, all four package formats + checksums attached).