json api cli working
This commit is contained in:
		| @@ -64,19 +64,33 @@ impl VeilidLogLevel { | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl FromStr for VeilidLogLevel { | ||||
|     type Err = VeilidAPIError; | ||||
|     fn from_str(s: &str) -> Result<Self, Self::Err> { | ||||
|         Ok(match s { | ||||
|             "Error" => Self::Error, | ||||
|             "Warn" => Self::Warn, | ||||
|             "Info" => Self::Info, | ||||
|             "Debug" => Self::Debug, | ||||
|             "Trace" => Self::Trace, | ||||
|             _ => { | ||||
|                 apibail_invalid_argument!("Can't convert str", "s", s); | ||||
|             } | ||||
|         }) | ||||
|     } | ||||
| } | ||||
| impl fmt::Display for VeilidLogLevel { | ||||
|     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { | ||||
|         let text = match self { | ||||
|             Self::Error => "ERROR", | ||||
|             Self::Warn => "WARN", | ||||
|             Self::Info => "INFO", | ||||
|             Self::Debug => "DEBUG", | ||||
|             Self::Trace => "TRACE", | ||||
|             Self::Error => "Error", | ||||
|             Self::Warn => "Warn", | ||||
|             Self::Info => "Info", | ||||
|             Self::Debug => "Debug", | ||||
|             Self::Trace => "Trace", | ||||
|         }; | ||||
|         write!(f, "{}", text) | ||||
|     } | ||||
| } | ||||
|  | ||||
| /// A VeilidCore log message with optional backtrace | ||||
| #[derive( | ||||
|     Debug, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user