Skip to content

Commit

Permalink
convert severity name to code
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Sep 23, 2016
1 parent ef988ed commit fd83874
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion inst/include/plog/Severity.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace plog
debug = 5,
verbose = 6
};

inline const char* getSeverityName(Severity severity)
{
switch (severity)
Expand All @@ -33,4 +33,22 @@ namespace plog
return "NONE";
}
}

inline Severity getSeverityCode(const std::string& name)
{
if (name == "FATAL")
return fatal;
if (name == "ERROR")
return error;
if (name == "WARN")
return warning;
if (name == "INFO")
return info;
if (name == "DEBUG")
return debug;
if (name == "VERB")
return verbose;

return none;
}
}

0 comments on commit fd83874

Please sign in to comment.