diff --git a/Cargo.toml b/Cargo.toml index c237313..0dcb4f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,5 +54,7 @@ serde_json = { version = "1.0", optional = true } thiserror = "1.0.48" uuid = "1.6.1" btleplug = "0.11.5" + +[dev-dependencies] fern = { version = "0.6.2", features = ["colored"] } humantime = "2.1.0" diff --git a/examples/basic_serial.rs b/examples/basic_serial.rs index 9df7c56..efe63bf 100644 --- a/examples/basic_serial.rs +++ b/examples/basic_serial.rs @@ -9,7 +9,8 @@ use std::time::SystemTime; use meshtastic::api::StreamApi; use meshtastic::utils; -/// Set up the logger to output to the console and to a file. +/// Set up the logger to output to stdout +/// **Note:** the invokation of this function is commented out in main by default. fn setup_logger() -> Result<(), fern::InitError> { fern::Dispatch::new() .format(|out, message, record| { @@ -30,7 +31,8 @@ fn setup_logger() -> Result<(), fern::InitError> { #[tokio::main] async fn main() -> Result<(), Box> { - setup_logger()?; + // Uncomment this to enable logging + // setup_logger()?; let stream_api = StreamApi::new(); @@ -54,8 +56,8 @@ async fn main() -> Result<(), Box> { // This loop can be broken with ctrl+c, or by disconnecting // the attached serial port. - while let Some(_decoded) = decoded_listener.recv().await { - // println!("Received: {:?}", decoded); + while let Some(decoded) = decoded_listener.recv().await { + println!("Received: {:?}", decoded); } // Note that in this specific example, this will only be called when diff --git a/examples/basic_tcp.rs b/examples/basic_tcp.rs index 4c5e2ba..63c0b82 100644 --- a/examples/basic_tcp.rs +++ b/examples/basic_tcp.rs @@ -9,7 +9,8 @@ use std::time::SystemTime; use meshtastic::api::StreamApi; use meshtastic::utils; -/// Set up the logger to output to the console and to a file. +/// Set up the logger to output to stdout +/// **Note:** the invokation of this function is commented out in main by default. fn setup_logger() -> Result<(), fern::InitError> { fern::Dispatch::new() .format(|out, message, record| { @@ -30,7 +31,8 @@ fn setup_logger() -> Result<(), fern::InitError> { #[tokio::main] async fn main() -> Result<(), Box> { - setup_logger()?; + // Uncomment this to enable logging + // setup_logger()?; let stream_api = StreamApi::new(); @@ -51,8 +53,8 @@ async fn main() -> Result<(), Box> { let stream_api = stream_api.configure(config_id).await?; // This loop can be broken with ctrl+c, or by unpowering the radio. - while let Some(_decoded) = decoded_listener.recv().await { - // println!("Received: {:?}", decoded); + while let Some(decoded) = decoded_listener.recv().await { + println!("Received: {:?}", decoded); } // Note that in this specific example, this will only be called when