Skip to content

[bug] WARN log when window is (re)focused #8494

@linden-dg

Description

@linden-dg

Describe the bug

When using the tauri_plugin_log plugin, the following warning log displays every time the window is refocused - i.e. you have to focus on another window, then click back onto the tauri window.

[2023-12-29][09:23:39][WARN][tao::platform_impl::platform::event_loop::runner] NewEvents emitted without explicit RedrawEventsCleared
[2023-12-29][09:23:39][WARN][tao::platform_impl::platform::event_loop::runner] RedrawEventsCleared emitted without explicit MainEventsCleared

This doesn't actually seem to affect the functionality of the app at all, but I'm currently trying to log errors/warnings to a log file in production and the file gets very large, very fast...

Additional notes:

  • it sometimes only triggers after 2-3 refocuses, but then triggers every time you refocus
  • you actually have to click on the window content as the refocus - i.e. Alt+Tab doesn't trigger, and clicking on the window's app bar also doesn't trigger it

Reproduction

  • run pnpm create tauri-app
  • choose the following options:
✔ Choose which language to use for your frontend · TypeScript / JavaScript - (pnpm, yarn, npm, bun)
✔ Choose your package manager · pnpm
✔ Choose your UI template · Solid - (https://www.solidjs.com/)
✔ Choose your UI flavor · TypeScript
  • add the plugin_log to your Cargo.toml:
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1", features = ["colored"] }
  • modify your main.rs to the following:
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use tauri_plugin_log::fern::colors::ColoredLevelConfig;
use tauri_plugin_log::LogTarget;

// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}! You've been greeted from Rust!", name)
}

fn main() {
    tauri::Builder::default()
        .plugin(
            tauri_plugin_log::Builder::default()
                .targets([LogTarget::Stdout])
                .with_colors(ColoredLevelConfig::default())
                .build(),
        )
        .invoke_handler(tauri::generate_handler![greet])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

  • run pnpm tauri dev
  • unfocus & refocus on the tauri window by clicking with your mouse

Expected behavior

The warning shouldn't show - either the underlying issue needs to be fixed, or the logging turned off for this issue?

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22621 X64
    ✔ WebView2: 120.0.2210.91
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.71.0 (8ede3aae2 2023-07-12)
    ✔ cargo: 1.71.0 (cfd3bbd8f 2023-06-08)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.19.0
    - pnpm: 8.6.3
    - npm: 10.2.3

[-] Packages
    - tauri [RUST]: 1.5.4
    - tauri-build [RUST]: 1.5.1
    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.5
    - @tauri-apps/api [NPM]: 1.5.2 (outdated, latest: 1.5.3)
    - @tauri-apps/cli [NPM]: 1.5.8 (outdated, latest: 1.5.9)

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: SolidJS
    - bundler: Vite

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: Windowsstatus: upstreamThis issue is blocked by upstream dependencies and we need to wait or contribute upstream fixestype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions