Commit 46f97685 authored by fegomes's avatar fegomes

change of scope the name_to_level variable

parent c21dd874
......@@ -87,16 +87,6 @@ enum level_enum
off = 6
};
static std::unordered_map<std::string, level_enum> name_to_level = {
{ "trace" , level::trace },
{ "debug" , level::debug },
{ "info" , level::info },
{ "warning" , level::warn },
{ "error" , level::err },
{ "critical", level::critical },
{ "off" , level::off }
};
#if !defined(SPDLOG_LEVEL_NAMES)
#define SPDLOG_LEVEL_NAMES { "trace", "debug", "info", "warning", "error", "critical", "off" }
......@@ -116,6 +106,15 @@ inline const char* to_short_str(spdlog::level::level_enum l)
}
inline spdlog::level::level_enum to_level_enum(const std::string& name)
{
static std::unordered_map<std::string, level_enum> name_to_level = {
{ level_names[0], level::trace },
{ level_names[1], level::debug },
{ level_names[2], level::info },
{ level_names[3], level::warn },
{ level_names[4], level::err },
{ level_names[5], level::critical },
{ level_names[6], level::off }
};
auto ci = name_to_level.find(name);
if (ci != name_to_level.end())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment