szaszm commented on code in PR #1670: URL: https://github.com/apache/nifi-minifi-cpp/pull/1670#discussion_r1356763815
########## libminifi/include/core/logging/Logger.h: ########## @@ -112,19 +62,42 @@ enum LOG_LEVEL { off = 6 }; +inline spdlog::level::level_enum mapToSpdLogLevel(LOG_LEVEL level) { + switch (level) { + case trace: return spdlog::level::trace; + case debug: return spdlog::level::debug; + case info: return spdlog::level::info; + case warn: return spdlog::level::warn; + case err: return spdlog::level::err; + case critical: return spdlog::level::critical; + case off: return spdlog::level::off; + } + throw std::invalid_argument(fmt::format("Invalid LOG_LEVEL {}", magic_enum::enum_underlying(level))); +} + +inline LOG_LEVEL mapFromSpdLogLevel(spdlog::level::level_enum level) { + switch (level) { + case spdlog::level::trace: return LOG_LEVEL::trace; + case spdlog::level::debug: return LOG_LEVEL::debug; + case spdlog::level::info: return LOG_LEVEL::info; + case spdlog::level::warn: return LOG_LEVEL::warn; + case spdlog::level::err: return LOG_LEVEL::err; + case spdlog::level::critical: return LOG_LEVEL::critical; + case spdlog::level::off: return LOG_LEVEL::off; + case spdlog::level::n_levels: {} // fallthrough + } + throw std::invalid_argument(fmt::format("Invalid spdlog::level::level_enum {}", magic_enum::enum_underlying(level))); +} + Review Comment: Why does this fall through? A break would mean the same in this case. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org