Add Logs to frontend#1756
Open
panda7789 wants to merge 1 commit into
Open
Conversation
Adds a "Logs" tab to the navbar (superusers only) that lists application log entries captured from backend/logger/logger.go. The logger now keeps an in-memory ring buffer of the last 1000 log lines (with level and timestamp) alongside its existing stdout/stderr output, exposed via a new GET /api/upsnap/logs endpoint. The frontend logs page polls this endpoint and renders entries in a table.
Owner
|
Okay, there are multiple things I would change:
let logs = $state([] as LogModel[]);
function getLogs() {
$pocketbase.logs
.getList()
.then((data) => {
logs = data;
})
.catch((err) => {
toast.error(err.message ?? String(err));
})
.finally(() => (loading = false));
}This would need some investigation to still print logs to the console and also how to filter them from all http request logs.
|
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.
Viewing logs currently requires opening the Docker logs, which is inconvenient. This PR adds a built-in log viewer directly to the application.
Changes
Notes
Please review the implementation carefully. I relied quite heavily on vibe coding for this feature since I primarily built it for my own use, so I'd appreciate an extra set of eyes on the overall design and implementation.
It looks like this
