| 34 | namespace framework |
| 35 | { |
| 36 | LogLevel log_level_from_name(const std::string &name) |
| 37 | { |
| 38 | static const std::map<std::string, LogLevel> levels = { |
| 39 | {"none", LogLevel::NONE}, |
| 40 | {"config", LogLevel::CONFIG}, |
| 41 | {"tests", LogLevel::TESTS}, |
| 42 | {"errors", LogLevel::ERRORS}, |
| 43 | {"warnings", LogLevel::WARNINGS}, |
| 44 | {"debug", LogLevel::DEBUG}, |
| 45 | {"measurements", LogLevel::MEASUREMENTS}, |
| 46 | {"all", LogLevel::ALL}, |
| 47 | }; |
| 48 | |
| 49 | try |
| 50 | { |
| 51 | return levels.at(tolower(name)); |
| 52 | } |
| 53 | catch (const std::out_of_range &) |
| 54 | { |
| 55 | throw std::invalid_argument(name); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | ::std::istream &operator>>(::std::istream &stream, LogLevel &level) |
| 60 | { |