fix(logging): include webview target in production log level config (#1059)

* fix(logging): include webview target in production log level config

In production mode, COCO_LOG was set to 'coco_lib=trace' which caused
the global log level to be set to Off first, then only coco_lib module
was enabled. This silently dropped all frontend logs whose target is
'webview', making them disappear in packaged builds while working fine
in dev mode (which uses the default Info level for all targets).

Fix by adding 'webview=trace' to the COCO_LOG value so frontend logs
are also captured in the log file when running the packaged app.

* docs: release notes
This commit is contained in:
SteveLauC
2026-04-21 11:24:41 +08:00
committed by GitHub
parent 6d68b2b372
commit aa1732413c
2 changed files with 4 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ Information about release notes of Coco App is provided here.
- fix: fix some filter fields not working #1037
- fix: apply local results weight to scores generated by rerank() #1036
- fix: resolve extension icon caching issue #1046
- fix(logging): include webview target in production log level config #1059
### ✈️ Improvements

View File

@@ -149,14 +149,14 @@ pub(crate) fn set_up_tauri_logger() -> TauriPlugin<tauri::Wry> {
builder
}
// When running the built binary, set `COCO_LOG` to `coco_lib=trace` to capture all logs
// that come from Coco in the log file, which helps with debugging.
// When running the built binary, set `COCO_LOG` to capture all logs from Coco and the
// webview (frontend) in the log file, which helps with debugging.
if !tauri::is_dev() {
// We have absolutely no guarantee that we (We have control over the Rust
// code, but definitely no idea about the libc C code, all the shared objects
// that we will link) will not concurrently read/write `envp`, so just use unsafe.
unsafe {
std::env::set_var("COCO_LOG", "coco_lib=trace");
std::env::set_var("COCO_LOG", "coco_lib=trace,webview=trace");
}
}