statsig_rust/console_capture/
console_log_line_levels.rs1#[derive(Debug, Clone, PartialEq)]
2pub enum StatsigLogLineLevel {
3 Trace,
4 Debug,
5 Log,
6 Info,
7 Warn,
8 Error,
9}
10
11impl StatsigLogLineLevel {
12 pub fn to_status_string(&self) -> String {
13 match self {
14 StatsigLogLineLevel::Trace => "trace".to_string(),
15 StatsigLogLineLevel::Debug => "debug".to_string(),
16 StatsigLogLineLevel::Log => "info".to_string(), StatsigLogLineLevel::Info => "info".to_string(),
18 StatsigLogLineLevel::Warn => "warn".to_string(),
19 StatsigLogLineLevel::Error => "error".to_string(),
20 }
21 }
22
23 pub fn from_string(level: &str) -> Option<StatsigLogLineLevel> {
24 match level.to_lowercase().as_str() {
25 "trace" => Some(StatsigLogLineLevel::Trace),
26 "debug" => Some(StatsigLogLineLevel::Debug),
27 "log" => Some(StatsigLogLineLevel::Log),
28 "info" => Some(StatsigLogLineLevel::Info),
29 "warn" | "warning" => Some(StatsigLogLineLevel::Warn),
30 "error" | "err" => Some(StatsigLogLineLevel::Error),
31 _ => None,
32 }
33 }
34}