I have one rust application (actix-web framework used). How can I get the logging level defined.
Requirement is to execute one method to log something if the logging level is “Debug”, otherwise not.
what should be the body of following is_degug_log_enabled
method
<code>#[tokio::main]
async fn main() {
SimpleLogger::new().env().with_level(LevelFilter::Error).init().unwrap();
if is_degug_log_enabled() {
any_logging_method();
}
}
fn is_degug_log_enabled() -> bool {
// in this case it should return false as logging level is 'Error'
}
</code>
<code>#[tokio::main]
async fn main() {
SimpleLogger::new().env().with_level(LevelFilter::Error).init().unwrap();
if is_degug_log_enabled() {
any_logging_method();
}
}
fn is_degug_log_enabled() -> bool {
// in this case it should return false as logging level is 'Error'
}
</code>
#[tokio::main]
async fn main() {
SimpleLogger::new().env().with_level(LevelFilter::Error).init().unwrap();
if is_degug_log_enabled() {
any_logging_method();
}
}
fn is_degug_log_enabled() -> bool {
// in this case it should return false as logging level is 'Error'
}