Skip to content

Logs and Debugging

temidaradev edited this page Nov 30, 2026 · 1 revision

Kopuz logs through tracing. Most of this is reachable from the app itself - Settings → Logs has Open logs folder, Export logs, and an Enable Performance Tracing toggle - so users never need a terminal to send a useful report.

Where the files live

All files sit in the logs directory (the Open logs folder button jumps straight here):

  • Linux: ~/.cache/kopuz/logs/
  • macOS: ~/Library/Caches/moe.kopuz.kopuz/logs/
  • Windows: %LOCALAPPDATA%\kopuz\kopuz\cache\logs\
File What it is
latest.log The current session. Span timing + events; the live log.
kopuz-<timestamp>.log Previous sessions, archived on startup (last 10 kept). A restart never erases the run before it.
crash-<timestamp>.txt Written only on a crash (Rust panic): message, backtrace, recent log tail, app/OS version.
kopuz-trace.json Performance trace - only when tracing is enabled (see below). Overwritten each run.

Timestamps are UTC YYYY-MM-DD_HH-MM-SS, so the files sort chronologically.

Triage cheat-sheet

App crashed → a crash-<timestamp>.txt is generated automatically. Ask the user for Settings → Logs → Export logs (bundles latest.log + the newest crash report into one file), or Open logs folder and grab the newest crash-*.txt.

Performance issue (freeze / slow load / stutter) → ask the user to:

  1. Settings → Logs → enable "Performance Tracing", then restart the app (the toggle warns about this - the trace recorder is set up once at startup).
  2. Reproduce the slow action.
  3. Quit the app (this flushes the trace cleanly).
  4. Settings → Logs → Open logs folder and send kopuz-trace.json (or Export logs).

Open the trace at speedscope.app or ui.perfetto.dev. Critical paths (YouTube stream resolve, browse/search/pagination, mix radio, library scan, downloads, playback transitions, per-component renders) are instrumented as named spans, and worker-thread work nests under the action that launched it, so the trace shows exactly where time goes. Turn it back off afterward - it adds overhead and grows the trace file during long sessions.

Power-user env vars

Log verbosity is controlled by env vars for terminal runs:

# Verbose (debug-level) logs for a session
KOPUZ_DEBUG=1 kopuz

# Fine-grained, per-module (overrides KOPUZ_DEBUG); standard tracing directive syntax
KOPUZ_LOG="server::ytmusic=trace,kopuz=debug" kopuz

# Deep render-tree profiling: Dioxus's own per-component render/diff spans
# (enable the trace toggle in Settings first; this just controls what's recorded)
KOPUZ_LOG="info,dioxus_core=trace" kopuz

RUST_LOG works too; KOPUZ_LOG takes precedence.

The performance trace is enabled only via Settings → Logs → Enable Performance Tracing (then restart) - there's no env var for it; the UI is the single source of truth. Off by default → zero overhead.

Debug builds add a Trigger crash button in Settings → Logs to exercise the crash-report path. It's compiled out of release builds.

Clone this wiki locally