Add the tracing and tracing-subscriber crates to your Cargo.toml and initialize the subscriber in main to capture logs.
[dependencies]
tracing = "0.1"
tracing-subscriber = "0.3"
use tracing::{info, error, Level};
use tracing_subscriber;
fn main() {
tracing_subscriber::fmt()
.with_max_level(Level::INFO)
.init();
info!("Application started");
error!("Something went wrong");
}