tauri-apps / tauri-apps/plugins-workspace

v2 log://log events are storing the Rust log::Level

Open
#1,193 1 comment 0 reactions 0 assignees View on GitHub
plugin: log type: bug type: feature request
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

Thanks for all the work around Tauri, v2 is amazing!
I noticed that there is a slight inconvenience around levels in the log plugin.

The plugin uses the following log level enum:
```js
export enum LogLevel {
Trace = 1,
Debug = 2,
Info = 3,
Warn = 4,
Error = 5,
}
```
.... while the enum in the log crate is flipped:
```rs
#[repr(usize)]
pub enum Level {
Error = 1,
Warn = 2,
Info = 3,
Debug = 4,
Trace = 5,
}
```

Now, it currently behaves a bit unintuitive when mixing webview logs with native logs.
When invoking the plugin command `plugin:log|log`, the handler is correctly mapping the webview level to the rust level.
However, events arriving in the webview at `log://log` are not mapped, so we currently have to map them back manually.

Since it's still the beta, wouldn't it make sense to not flip the enum order here and just use the log::LogLevel one?
If not, it would probably make sense to map levels arriving at `log://log` to the js ones.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.