tuwunel_core/log/fmt_span.rs
1use tracing_subscriber::fmt::format::FmtSpan;
2
3use crate::Result;
4
5#[inline]
6pub fn from_str(str: &str) -> Result<FmtSpan, FmtSpan> {
7 match str.to_uppercase().as_str() {
8 | "ENTER" => Ok(FmtSpan::ENTER),
9 | "EXIT" => Ok(FmtSpan::EXIT),
10 | "NEW" => Ok(FmtSpan::NEW),
11 | "CLOSE" => Ok(FmtSpan::CLOSE),
12 | "ACTIVE" => Ok(FmtSpan::ACTIVE),
13 | "FULL" => Ok(FmtSpan::FULL),
14 | "NONE" => Ok(FmtSpan::NONE),
15 | _ => Err(FmtSpan::NONE),
16 }
17}