tauri-apps / tauri-apps/plugins-workspace
[bug] tauri_plugin_log with TargetKind::Webview causes infinite log loop
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 602
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 9
Description
### Describe the bug
When using the `tauri_plugin_log` plugin with the Webview target as such
```
.plugin(
tauri_plugin_log::Builder::new()
.targets([Target::new(TargetKind::Stdout), Target::new(TargetKind::Webview)])
.level(LevelFilter::Info)
.build(),
)
```
I get an infinite stream of
```
[2024-12-03][07:20:30][tauri::manager][INFO] app::emit; event="log://log"
[2024-12-03][07:20:30][tauri::manager][INFO] app::emit; event="log://log"
[2024-12-03][07:20:30][tauri::manager][INFO] app::emit; event="log://log"
[2024-12-03][07:20:30][tauri::manager][INFO] app::emit; event="log://log"
[2024-12-03][07:20:30][tauri::manager][INFO] app::emit; event="log://log"
[2024-12-03][07:20:30][tauri::manager][INFO] app::emit; event="log://log"
[2024-12-03][07:20:30][tauri::manager][INFO] app::emit; event="log://log"
[2024-12-03][07:20:30][tauri::manager][INFO] app::emit; event="log://log"
[2024-12-03][07:20:30][tauri::manager][INFO] app::emit; event="log://log"
...
```
This is likely caused by the emit event handler emitting a lot which in turn calls the WebView target handler which calls emit etc..
I'm not sure if there's any config I'm supposed to have set to pre-filter that log message. Either one would need to avoid `emit` creating any log messages or try to manually not trigger `emit` on such messages for WebView targets.
### Reproduction
_No response_
### Expected behavior
_No response_
### Full `tauri info` output
```text
cargo tauri info
WARNING: no lock files found, defaulting to npm
[✔] Environment
- OS: Mac OS 15.1.1 X64
✔ Xcode Command Line Tools: installed
✔ rustc: 1.82.0-nightly (28a58f2fa 2024-07-31)
✔ cargo: 1.82.0-nightly (257b72b8a 2024-07-30)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: nightly-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
- node: 20.10.0
- yarn: 1.22.19
- npm: 10.2.4
[-] Packages
- tauri [RUST]: 2.1.1
- tauri-build [RUST]: 2.0.3
- wry [RUST]: 0.47.2
- tao [RUST]: 0.30.8
- tauri-cli [RUST]: 2.0.0-beta.20
- @tauri-apps/api : not installed!
- @tauri-apps/cli [NPM]: 2.0.0-beta.20 (outdated, latest: 2.1.0)
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
[-] iOS
- Developer Teams: ...
```
### Stack trace
_No response_
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.