mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-02 01:52:22 +08:00
feat(logging): add crash logging and improve log management (#562)
* feat(logging): add crash logging and improve log management - Add panic hook to capture crash info to ~/.cc-switch/crash.log - Records timestamp, app version, OS/arch, thread info - Full stack trace with force_capture for release builds - Safe error handling (no nested panics) - Enable logging for both Debug and Release builds - Info level for all builds - Output to console and ~/.cc-switch/logs/ - 5MB max file size with rotation - Add log cleanup on startup - Keep only 2 most recent log files - Works on all platforms - Change panic strategy from "abort" to "unwind" - Required for backtrace capture in release builds * fix(logging): use OnceLock for config dir and add URL redaction - Use OnceLock to support custom config directory override for crash.log - Add redact_url_for_log() to protect sensitive URL parameters in logs - Change verbose deep link logs from info to debug level - Move Store refresh before panic_hook init to ensure correct path --------- Co-authored-by: Jason <farion1231@gmail.com>
This commit is contained in:
@@ -77,7 +77,8 @@ objc2-app-kit = { version = "0.2", features = ["NSColor"] }
|
||||
codegen-units = 1
|
||||
lto = "thin"
|
||||
opt-level = "s"
|
||||
panic = "abort"
|
||||
# 使用 unwind 以便 panic hook 能捕获 backtrace(abort 会直接终止无法捕获)
|
||||
panic = "unwind"
|
||||
strip = "symbols"
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
Reference in New Issue
Block a user