Logging messages

Logging is not useful without the contextual data of the code. Every logging macro expects a text message that can contain positional parameters. For example, take a look at the println! macro:

debug!("Trying to bind server to address: {}", addr);

The preceding code will work for types that implement the Display trait. As in the println! macro, you can add types that implement the Debug trait with the {:?} formatter. It's useful to derive the Debug trait for all types in your code with #[derive(Debug)] and set the  #![deny(missing_debug_implementations)] attribute for the whole crate.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.31.22