Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ankoh opened this issue Apr 16, 2024 · 1 comment
Open

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

ankoh opened this issue Apr 16, 2024 · 1 comment
Labels
bug Something isn't working enhancement New feature or request plugin: log

Comments

@ankoh
Copy link

ankoh commented Apr 16, 2024

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:

export enum LogLevel {
    Trace = 1,
    Debug = 2,
    Info = 3,
    Warn = 4,
    Error = 5,
}

.... while the enum in the log crate is flipped:

#[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.

@FabianLars
Copy link
Member

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?

imo, yes. Would you mind opening a PR?

@FabianLars FabianLars added plugin: log bug Something isn't working enhancement New feature or request labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request plugin: log
Projects
None yet
Development

No branches or pull requests

2 participants