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

recorder logs in app ui does not work on windows #376

Open
louis030195 opened this issue Sep 28, 2024 · 8 comments
Open

recorder logs in app ui does not work on windows #376

louis030195 opened this issue Sep 28, 2024 · 8 comments

Comments

@louis030195
Copy link
Collaborator

for some reason

Copy link

linear bot commented Sep 28, 2024

@tribhuwan-kumar
Copy link
Contributor

I'm trying to debug it, is it working on other OS ?

@louis030195
Copy link
Collaborator Author

yes on macos

@louis030195
Copy link
Collaborator Author

@tribhuwan-kumar is this issue still happening?

@tribhuwan-kumar
Copy link
Contributor

@tribhuwan-kumar is this issue still happening?

yup, i tried to debug it but got no clue what's causing this issue, i'll try to fix it again

still same

image

@tribhuwan-kumar
Copy link
Contributor

@louis030195 i couldn't find what causing this issue :( the issue might be related to localforage

the only solution, i can think right now is writing a different recorder log viewer especially for windows or modifying this components logic for windows

@louis030195
Copy link
Collaborator Author

weird

just using tauri native event stuff https://v2.tauri.app/develop/calling-frontend/#listening-to-events

@tribhuwan-kumar
Copy link
Contributor

tribhuwan-kumar commented Nov 5, 2024

@louis030195
the issue is with tauri's emitter
tauri-apps/tauri#8177
since log viewer is using tauri's listen to get emitted log but it fails in windows when there is high call rate. this same issue is also occurring when i tried to listen download status for #632

a member of tauri suggested this solution, i'll try to fix with it

log-viewer-v2.tsx

import { listen } from "@tauri-apps/api/event";

    const unlisten = listen<string>("sidecar_log", (event) => {
      setLogs((prevLogs) => {
        const newLogs = [...prevLogs, event.payload].slice(-100);
        localforage.setItem("sidecar_logs", newLogs);
        return newLogs;
      });
    });

    return () => {
      unlisten.then((f) => f());
    };

sidercar.rs

    tauri::async_runtime::spawn(async move {
        while let Some(event) = rx.recv().await {
            match event {
                CommandEvent::Stdout(line) => {
                    let log_line = String::from_utf8(line).unwrap();
                    print!("{}", log_line);
                    app_handle.emit("sidecar_log", log_line).unwrap();
                }
                CommandEvent::Stderr(line) => {
                    let log_line = String::from_utf8(line).unwrap();
                    error!("Sidecar stderr: {}", log_line);
                    app_handle
                        .emit("sidecar_log", format!("ERROR: {}", log_line))
                        .unwrap();
                }
                _ => {}
            }
        }
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants