#Logging in rust tests

7 messages · Page 1 of 1 (latest)

cursive fox
#

Hey,

Is there a way to setup logging in rust backend tests (with tokio) so I can just run cargo test or optionally with -- --nocapture and use the info! macro to debug prints from my rust tests?
Currently it's not showing any output in the console. Maybe I'm missing some .env settings, but where do I put those?

obsidian skiff
#

Is this on Windows with release builds?

#

cargo test should have debug symbols so the terminal should still be attached.

cursive fox
#

`#[cfg(test)]
mod tests {
#![allow(unused)]
use super::*;
use anyhow::Result;
use log::{debug, info};
use serde_json::json;
use test_log::test;

#[tokio::test]
async fn test_name() -> Result<()> {
    info!("hello");

    Ok(())
}

}`

#

on ubuntu via wsl2

#

Since im still new to rust, i'm not sure if this is even tauri related.