#logging in server fns in 0.6

1 messages · Page 1 of 1 (latest)

mighty lintel
#
// dioxus alpha 2
dioxus = { git = "https://github.com/DioxusLabs/dioxus.git", rev = "b20db13", features = ["fullstack"] }

#![allow(non_snake_case)]

use dioxus::prelude::*;
use dioxus_logger::tracing;

fn main() {
    dioxus_logger::init(tracing::Level::INFO).expect("failed to init logger");
    tracing::info!("starting app"); // <<<<<< this works
    launch(App);
}

fn App() -> Element {
    let server_future = use_server_future(get_server_data)?;

    rsx! {
        button {
            onclick: move |_| async move {
                tracing::info!("client side");  // <<<<<< this works
                if let Ok(data) = get_server_data().await {
                    post_server_data(data).await.unwrap();
                }
            },
            "Run a server function!"
        }
    }
}

#[server(PostServerData)]
async fn post_server_data(data: String) -> Result<(), ServerFnError> {
    tracing::info!("Server received: {}", data);  // <<<<<< this doesn't work
    Ok(())
}

#[server(GetServerData)]
async fn get_server_data() -> Result<String, ServerFnError> {
    tracing::info!("get_server_data");   // <<<<<< this doesn't work
    Ok("Hello from the server!".to_string())
}

None of the logs in the server fns work. Do I need to configure something to make them print?

mighty lintel
#

logging in server fns in 0.6