From fbf2e942a96506c8cbb952d0fed67534bcefac13 Mon Sep 17 00:00:00 2001 From: gabime Date: Wed, 26 Feb 2020 18:33:49 +0200 Subject: [PATCH] Allow "err" when converting string to level --- include/spdlog/common-inl.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/spdlog/common-inl.h b/include/spdlog/common-inl.h index a59742d9..411e2819 100644 --- a/include/spdlog/common-inl.h +++ b/include/spdlog/common-inl.h @@ -34,8 +34,16 @@ SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG } level++; } - // allow warn = warning before giving up - return name == "warn" ? level::warn : level::off; + // check also for "warn" and "err" before giving up.. + if (name == "warn") + { + return level::warn; + } + if (name == "err") + { + return level::err; + } + return level::off; } } // namespace level