Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log viewer to WebUI #780

Merged
merged 5 commits into from
Dec 11, 2023
Merged

Add log viewer to WebUI #780

merged 5 commits into from
Dec 11, 2023

Conversation

skrashevich
Copy link
Contributor

This commit introduces the ability to handle log files through the API and provides a new log viewing page. The API now supports GET and DELETE methods for log file operations, allowing retrieval and deletion of log contents. A new log.html page has been added for viewing logs in the browser, with automatic refresh every 5 seconds and styling based on log levels.

image

The app.go file has been updated to include a GetLogFilepath function that retrieves or generates the log file path. The NewLogger function now accepts a file parameter to enable file logging. The main.js file has been updated to include a link to the new log.html page.

This enhancement improves the observability and management of the application by providing real-time access to logs and the ability to clear them directly from the web interface.

This commit introduces the ability to handle log files through the API and
provides a new log viewing page. The API now supports GET and DELETE methods
for log file operations, allowing retrieval and deletion of log contents.
A new log.html page has been added for viewing logs in the browser, with
automatic refresh every 5 seconds and styling based on log levels.

The app.go file has been updated to include a GetLogFilepath function that
retrieves or generates the log file path. The NewLogger function now accepts
a file parameter to enable file logging. The main.js file has been updated
to include a link to the new log.html page.

This enhancement improves the observability and management of the application
by providing real-time access to logs and the ability to clear them directly
from the web interface.
This commit refactors the log handling in the API to use a switch statement for improved readability and maintainability. It also introduces error messages with more context when reading or truncating the log file fails.

On the frontend, a new auto-update toggle button has been added to the log viewer, allowing users to enable or disable automatic log updates. The button's appearance changes based on its state, providing a clear visual indication of whether auto-update is active. Additionally, the button styling has been updated to ensure consistency across the interface.
@skrashevich
Copy link
Contributor Author

upd:
image

@AlexxIT AlexxIT self-assigned this Dec 7, 2023
AlexxIT added a commit that referenced this pull request Dec 11, 2023
@AlexxIT AlexxIT merged commit 1f3a320 into AlexxIT:master Dec 11, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Dec 11, 2023

Thanks. A bit of a rewrite to jsonlines and circular buffer.

@skrashevich skrashevich deleted the log-viewer branch December 18, 2023 09:48
@AlexxIT AlexxIT added this to the v1.8.5 milestone Jan 1, 2024
@AlexxIT AlexxIT changed the title Add log file handling and viewing capabilities Add log viewer to WebUI Jan 1, 2024
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.

None yet

2 participants