Skip to content

Added Rolling Application Log Files - #16

Open
seanpar203 wants to merge 1 commit into
cppalliance:masterfrom
seanpar203:feat/workshop-logging
Open

Added Rolling Application Log Files#16
seanpar203 wants to merge 1 commit into
cppalliance:masterfrom
seanpar203:feat/workshop-logging

Conversation

@seanpar203

@seanpar203 seanpar203 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Essentially this PR introduces capturing logging that's happening in different parts of the application and storing logs in the idiomatic place PER platform:
• macOS: ~/Library/Logs/PromptForge/
• Windows: %LOCALAPPDATA%\PromptForge\logs\
• Linux / BSD: ${XDG_STATE_HOME:-~/.local/state}/promptforge/logs/

And supports an overridable custom location by setting the PROMPTFORGE_LOG_DIR env variable.

Screenshot 2026-09-04 at 1 00 08 PM

The workshop desktop app lacked persistent logging for diagnostics and panic backtraces. `crates/workshop/src/logging.rs` introduces `init_logging`, configuring a `tracing_subscriber` with daily rolling files via `tracing-appender` alongside stderr output, and installs a custom panic hook. `main` in `crates/workshop/src/main.rs` initializes the subscriber and replaces ad-hoc `eprintln!` calls with structured `tracing` events.

- `resolve_log_dir` places log files under platform per-user directories and allows an override through `PROMPTFORGE_LOG_DIR`.
- `install_panic_hook` captures unhandled panics and backtraces through `tracing::error!` before invoking the previous panic hook.
- Existing test suites are unchanged; new unit tests in `crates/workshop/src/logging.rs` verify directory resolution paths and fallbacks.
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