| 28 | } |
| 29 | |
| 30 | bool log_level_parse(const char *levelstr, size_t len, |
| 31 | enum log_level *level) |
| 32 | { |
| 33 | for (size_t i = 0; i < ARRAY_SIZE(ll_names); i++) { |
| 34 | if (streq_case(ll_names[i], levelstr, len)) { |
| 35 | *level = i; |
| 36 | return true; |
| 37 | } |
| 38 | } |
| 39 | /* We also allow "error" and "warn" */ |
| 40 | if (streq_case("error", levelstr, len)) { |
| 41 | *level = LOG_BROKEN; |
| 42 | return true; |
| 43 | } |
| 44 | if (streq_case("warn", levelstr, len)) { |
| 45 | *level = LOG_UNUSUAL; |
| 46 | return true; |
| 47 | } |
| 48 | |
| 49 | return false; |
| 50 | } |
no test coverage detected