mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #5009] [MERGED] feat(desktop): file-based logs with rotation #5017
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5017
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?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5009
Author: @CuriousCorrelation
Created: 4/21/2025
Status: ✅ Merged
Merged: 4/25/2025
Merged by: @AndrewBastin
Base:
next← Head:feat-desktop-log-rotation📝 Commits (1)
8a8891dfeat(desktop): file-based logs with rotation📊 Changes
5 files changed (+111 additions, -105 deletions)
View changed files
📝
packages/hoppscotch-desktop/src-tauri/Cargo.lock(+41 -91)📝
packages/hoppscotch-desktop/src-tauri/Cargo.toml(+2 -0)📝
packages/hoppscotch-desktop/src-tauri/src/lib.rs(+15 -2)➕
packages/hoppscotch-desktop/src-tauri/src/logger.rs(+52 -0)📝
packages/hoppscotch-desktop/src-tauri/src/main.rs(+1 -12)📄 Description
This PR adds a file-based logging system with size-based rotation to the desktop application. It essentially redirects existing diagnostic to size-based rotating files for troubleshooting environment-specific issues.
Closes HFE-801
The desktop application currently lacks a persistent logging mechanism in production environments. Logs are only available through the development mode console.
This PR will help diagnose issues reported in #4859, #4950, #5003, discussions #4984 and #4986.
Mainly aiming to understand errors in specific environments that can't be reproduced in our testing setups.
This implementation uses the tracing ecosystem (
tracing,tracing_subscriber,tracing_appender) along withfile_rotateto create log files in the platform's log directory. The logs are automatically rotated when they reach10MB, with a maximum of5files retained.Thinking 10 * 5 MB is reasonable disk usage while maintaining sufficient history.
The system currently writes to both the console (with ANSI colors where supported) and to files (without ANSI formatting for readability). Log levels are currently controlled via the
RUST_LOGenvironment variable, defaulting to "debug" when not specified.C:\Users\<username>\AppData\Local\io.hoppscotch.desktop\logs\io.hoppscotch.desktop.log~/Library/Logs/io.hoppscotch.desktop/io.hoppscotch.desktop.log~/.local/share/io.hoppscotch.desktop/logs/io.hoppscotch.desktop.log🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.