1use log_easy::{
6 LogLevel, Logger, debug, error, info, trace, try_debug, try_error, try_info, try_trace,
7 try_warn, warn,
8};
9use std::io::Result;
10
11fn main() -> Result<()> {
12 log_easy::init_with(Logger::new("target/global.log").with_level(LogLevel::Trace))?;
14
15 trace!("This is a trace message");
17 debug!("Debugging information here");
18 info!("Application started");
19 warn!("This is a warning");
20 error!("An error occurred");
21
22 try_trace!("This is a trace message using the try macro")?;
24 try_debug!("This is a debug message using the try macro")?;
25 try_info!("This is an info message using the try macro")?;
26 try_warn!("This is a warning message using the try macro")?;
27 try_error!("This is an error message using the try macro")?;
28
29 let user = "joe";
31 let attempts = 3;
32 let elapsed_ms = 127;
33 info!("User {user} has attempted login {attempts} times ({elapsed_ms}ms elapsed)");
34
35 Ok(())
36}