Log error

    0

    0

    Giovanny Gongora

    Codiga's Rust Recipes

    log an error in the console

    fn execute_query(_query: &str) -> Result<(), &'static str> {
      Err("I'm afraid I can't do that")
    }
    fn main() {
      env_logger::init();
      let response = execute_query("DROP TABLE students");
      if let Err(err) = response {
        log::error!("Failed to execute query: {}", err);
      }
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.