Closed KodrAus closed 2 months ago
This example:
#[emit::info_span(err_lvl: "warn", "Greeting {#[emit::as_serde] user}")] fn greet(user: &User) -> Result<(), std::io::Error> { if user.name == "Mars" { return Err(std::io::Error::new(std::io::ErrorKind::Other, "refusing to greet user")); } emit::info!("Hello, {#[emit::as_serde] user}!"); Ok(()) }
doesn't emit with the warn error level because the return statement returns before the level handling. We need to wrap the generated code in a closure.
warn
return
This example:
doesn't emit with the
warn
error level because thereturn
statement returns before the level handling. We need to wrap the generated code in a closure.