| 27 | } |
| 28 | |
| 29 | std::optional<LogLevel> FromString(std::string const & s) |
| 30 | { |
| 31 | ASSERT(!s.empty(), ("Log level should not be empty")); |
| 32 | |
| 33 | auto const & names = GetLogLevelNames(); |
| 34 | auto const it = std::find(names.begin(), names.end(), std::toupper(s[0])); |
| 35 | if (it == names.end()) |
| 36 | return {}; |
| 37 | return static_cast<LogLevel>(std::distance(names.begin(), it)); |
| 38 | } |
| 39 | |
| 40 | std::array<char, NUM_LOG_LEVELS> const & GetLogLevelNames() |
| 41 | { |