use std::env;
      use env_logger::Builder;
      
      fn main() {
        Builder::new()
        .parse(&env::var("MY_APP_LOG").unwrap_or_default())
        .init();
        log::info!("informational message");
        log::warn!("warning message");
        log::error!("this is an error {}", "message");
      }
      

      Rust language logo
      Log level with env

      Codiga's Rust Recipes

      level based in env variables

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.