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

Log output missing last character #3554

Open
Gabgobie opened this issue Jan 13, 2025 · 0 comments
Open

Log output missing last character #3554

Gabgobie opened this issue Jan 13, 2025 · 0 comments
Labels
bug Something isn't working cli Related to the dioxus-cli program

Comments

@Gabgobie
Copy link

Problem

I am using the Dioxus logger to observe my basicauth login page before building the backend. I noticed that the log output is sometimes missing the last character. The same log output in the browser console is not missing the last character.

I am guessing this issue is related to dx serve.

use dioxus::prelude::*;
use dioxus::logger::tracing::info;

#[component]
pub fn BasicAuth() -> Element {
    let mut email: Signal<String> = use_signal(|| "123".to_string());
    let mut password: Signal<String> = use_signal(|| "123".to_string());

    rsx! {
        div {
            div { class: "relative mt-2 w-full",
                input {
                    oninput: move |event| email.set(event.value()),
                    placeholder: "",
                    r#type: "text",
                    value: "",
                    class: "border-1 peer block w-full appearance-none rounded-lg border border-gray-300 bg-transparent px-2.5 pb-2.5 pt-4 text-sm text-gray-900 focus:border-blue-600 focus:outline-none focus:ring-0",
                    id: "email",
                }
                label {
                    r#for: "email",
                    class: "absolute top-2 left-1 z-10 origin-[0] -translate-y-4 scale-75 transform cursor-text select-none bg-white px-2 text-sm text-gray-500 duration-300 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:scale-100 peer-focus:top-2 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:px-2 peer-focus:text-blue-600",
                    "Enter Your Email"
                }
            }
        }
        div {
            div { class: "relative mt-2 w-full",
                input {
                    oninput: move |event| password.set(event.value()),
                    placeholder: "",
                    r#type: "password",
                    class: "border-1 peer block w-full appearance-none rounded-lg border border-gray-300 bg-transparent px-2.5 pb-2.5 pt-4 text-sm text-gray-900 focus:border-blue-600 focus:outline-none focus:ring-0",
                    id: "password",
                }
                label {
                    r#for: "password",
                    class: "absolute top-2 left-1 z-10 origin-[0] -translate-y-4 scale-75 transform cursor-text select-none bg-white px-2 text-sm text-gray-500 duration-300 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:scale-100 peer-focus:top-2 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:px-2 peer-focus:text-blue-600",
                    "Enter Your Password"
                }
            }
        }
        button {
            class: "rounded-lg bg-blue-600 py-3 font-bold text-white",
            onclick: move |_| {
                info!("Login button clicked");
                info!("Email: {}", email.peek());
                info!("Password: {}", password.peek());
                info!("This is a very very very very long log message that should not be truncated");
            },
            "Login"
        }
    }
}
03:42:19 [dev] Build completed in 3697ms
03:42:33 [web] %cINFO%c frontend\src\components\login\basicauth.rs:46%c Login button clicked
03:42:33 [web] %cINFO%c frontend\src\components\login\basicauth.rs:47%c Email: test@example.com
03:42:33 [web] %cINFO%c frontend\src\components\login\basicauth.rs:48%c Password: test1
03:42:33 [web] %cINFO%c frontend\src\components\login\basicauth.rs:49%c This is a very very very very long log message that should not be truncate
03:42:54 [web] %cINFO%c frontend\src\components\login\basicauth.rs:46%c Login button clicked
03:42:54 [web] %cINFO%c frontend\src\components\login\basicauth.rs:47%c Email: longname.test@example.co
03:42:54 [web] %cINFO%c frontend\src\components\login\basicauth.rs:48%c Password: test1
03:42:54 [web] %cINFO%c frontend\src\components\login\basicauth.rs:49%c This is a very very very very long log message that should not be truncate
╭────────────────────────────────────────────────────────────────────────────────────────── /:more ╮
│  App:     ━━━━━━━━━━━━━━━━━━━━━━━━━━  🎉 2.2s      Platform: Web                                 │
│  Bundle:  ━━━━━━━━━━━━━━━━━━━━━━━━━━  🎉 5.5s      App features: ["web", "auth-basic",           │
│  Status:  Serving frontend 🚀 7.7s                 Serving at: http://127.0.0.1:8080             │
│                                                                                                  │
│  dx version: 0.6.1-main                                                                          │
│  rustc: 1.79.9 (nightly)                                                                         │
│  Hotreload: rsx only                                                                             │
│                                                                                                  │
│  Read the docs: https://dioxuslabs.com/0.6/docs                                                  │
│  Video tutorials: https://youtube.com/@DioxusLabs                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

Steps To Reproduce

Steps to reproduce the behavior:

General reproduction:

Use dioxus::logger::tracing::info and print messages of different length to the console. Short messages will work while long messages will be missing the last character.

My specific issue:

  • Use dx serve for the web target
  • host a login page using the component I posted above
  • enter enything into the input fields and press the login button

Expected behavior

The full log message is printed. (Just like in the browser console)

Environment:

  • Dioxus version: 0.6.1-main
  • Rust version: 1.79.9 (nightly)
  • OS info: Windows 10 Pro
  • App platform: web

Questionnaire

I am using Dioxus for my first large scale project and at the same time first Rust project. I am unfortunately not up to the task of fixing this myself but I didn't want to let it go unnoticed.

@ealmloff ealmloff added bug Something isn't working cli Related to the dioxus-cli program labels Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Related to the dioxus-cli program
Projects
None yet
Development

No branches or pull requests

2 participants