// If the string is of the form "LogLevel::foo" or "LogLevel(foo)"
// strip it down just to "foo". This makes sure we can process both
- // the "LogLevel::DEBUG" and "LogLevel(1234)" formats produced by
+ // the "LogLevel::WARN" and "LogLevel(1234)" formats produced by
// logLevelToString().
constexpr StringPiece lowercasePrefix{"loglevel::"};
constexpr StringPiece wrapperPrefix{"loglevel("};
return LogLevel::UNINITIALIZED;
} else if (lowerName == "none") {
return LogLevel::NONE;
- } else if (lowerName == "debug") {
- return LogLevel::DEBUG;
+ } else if (lowerName == "debug" || lowerName == "dbg") {
+ return LogLevel::DBG;
} else if (lowerName == "info") {
return LogLevel::INFO;
} else if (lowerName == "warn" || lowerName == "warning") {
auto level = folly::to<uint32_t>(lowerName);
return static_cast<LogLevel>(level);
} catch (const std::exception&) {
- throw std::range_error("invalid logger name " + name.str());
+ throw std::range_error("invalid logger level: " + name.str());
}
}
return "UNINITIALIZED";
} else if (level == LogLevel::NONE) {
return "NONE";
- } else if (level == LogLevel::DEBUG) {
+ } else if (level == LogLevel::DBG) {
return "DEBUG";
} else if (level == LogLevel::INFO) {
return "INFO";
}
if (static_cast<uint32_t>(level) <= static_cast<uint32_t>(LogLevel::DBG0) &&
- static_cast<uint32_t>(level) > static_cast<uint32_t>(LogLevel::DEBUG)) {
+ static_cast<uint32_t>(level) > static_cast<uint32_t>(LogLevel::DBG)) {
auto num =
static_cast<uint32_t>(LogLevel::DBG0) - static_cast<uint32_t>(level);
return folly::to<string>("DBG", num);
os << logLevelToString(level);
return os;
}
-}
+} // namespace folly