EXPECT_EQ(LogLevel::NONE, stringToLogLevel("NoNe"));
EXPECT_EQ(LogLevel::NONE, stringToLogLevel("LogLevel::none"));
- EXPECT_EQ(LogLevel::DEBUG, stringToLogLevel("debug"));
- EXPECT_EQ(LogLevel::DEBUG, stringToLogLevel("dEBug"));
- EXPECT_EQ(LogLevel::DEBUG, stringToLogLevel("loglevel::dEBug"));
+ EXPECT_EQ(LogLevel::DBG, stringToLogLevel("debug"));
+ EXPECT_EQ(LogLevel::DBG, stringToLogLevel("dEBug"));
+ EXPECT_EQ(LogLevel::DBG, stringToLogLevel("Dbg"));
+ EXPECT_EQ(LogLevel::DBG, stringToLogLevel("loglevel::dEBug"));
+ EXPECT_EQ(LogLevel::DBG, stringToLogLevel("loglevel::DBG"));
EXPECT_EQ(LogLevel::INFO, stringToLogLevel("info"));
EXPECT_EQ(LogLevel::INFO, stringToLogLevel("INFO"));
EXPECT_EQ(LogLevel::ERR, stringToLogLevel("err"));
EXPECT_EQ(LogLevel::ERR, stringToLogLevel("eRr"));
EXPECT_EQ(LogLevel::ERR, stringToLogLevel("error"));
+ EXPECT_EQ(LogLevel::ERR, stringToLogLevel("ERR"));
EXPECT_EQ(LogLevel::ERR, stringToLogLevel("ERROR"));
EXPECT_EQ(LogLevel::CRITICAL, stringToLogLevel("critical"));
EXPECT_EQ(LogLevel::DBG5, stringToLogLevel("dbg5"));
EXPECT_EQ(LogLevel::DBG5, stringToLogLevel("DBG5"));
EXPECT_EQ(LogLevel::DBG9, stringToLogLevel("DBG9"));
- EXPECT_EQ(LogLevel::DEBUG + 1, stringToLogLevel("DBG99"));
- EXPECT_EQ(LogLevel::DEBUG, stringToLogLevel("900"));
- EXPECT_EQ(LogLevel::DEBUG, stringToLogLevel("LogLevel(900)"));
+ EXPECT_EQ(LogLevel::DBG + 1, stringToLogLevel("DBG99"));
+ EXPECT_EQ(LogLevel::DBG, stringToLogLevel("900"));
+ EXPECT_EQ(LogLevel::DBG, stringToLogLevel("LogLevel(900)"));
EXPECT_THROW(stringToLogLevel("foobar"), std::range_error);
- EXPECT_THROW(stringToLogLevel("dbg"), std::range_error);
+ EXPECT_THROW(stringToLogLevel("dbgx"), std::range_error);
EXPECT_THROW(stringToLogLevel("dbgxyz"), std::range_error);
EXPECT_THROW(stringToLogLevel("dbg-1"), std::range_error);
EXPECT_THROW(stringToLogLevel("dbg12345"), std::range_error);
}
TEST(LogLevel, toString) {
- EXPECT_EQ(
- "LogLevel::UNINITIALIZED", logLevelToString(LogLevel::UNINITIALIZED));
- EXPECT_EQ("LogLevel::NONE", logLevelToString(LogLevel::NONE));
- EXPECT_EQ("LogLevel::INFO", logLevelToString(LogLevel::INFO));
- EXPECT_EQ("LogLevel::WARN", logLevelToString(LogLevel::WARN));
- EXPECT_EQ("LogLevel::WARN", logLevelToString(LogLevel::WARNING));
- EXPECT_EQ("LogLevel::DEBUG", logLevelToString(LogLevel::DEBUG));
- EXPECT_EQ("LogLevel::ERR", logLevelToString(LogLevel::ERR));
- EXPECT_EQ("LogLevel::CRITICAL", logLevelToString(LogLevel::CRITICAL));
- EXPECT_EQ("LogLevel::DFATAL", logLevelToString(LogLevel::DFATAL));
- EXPECT_EQ("LogLevel::FATAL", logLevelToString(LogLevel::FATAL));
- EXPECT_EQ("LogLevel::FATAL", logLevelToString(LogLevel::MAX_LEVEL));
-
- EXPECT_EQ("LogLevel::DBG0", logLevelToString(LogLevel::DBG0));
- EXPECT_EQ("LogLevel::DBG2", logLevelToString(LogLevel::DBG2));
- EXPECT_EQ("LogLevel::DBG5", logLevelToString(LogLevel::DBG5));
- EXPECT_EQ("LogLevel::DBG9", logLevelToString(LogLevel::DBG9));
- EXPECT_EQ("LogLevel::DBG97", logLevelToString(static_cast<LogLevel>(903)));
- EXPECT_EQ("LogLevel::DBG64", logLevelToString(LogLevel::DBG4 - 60));
+ EXPECT_EQ("UNINITIALIZED", logLevelToString(LogLevel::UNINITIALIZED));
+ EXPECT_EQ("NONE", logLevelToString(LogLevel::NONE));
+ EXPECT_EQ("INFO", logLevelToString(LogLevel::INFO));
+ EXPECT_EQ("WARN", logLevelToString(LogLevel::WARN));
+ EXPECT_EQ("WARN", logLevelToString(LogLevel::WARNING));
+ EXPECT_EQ("DEBUG", logLevelToString(LogLevel::DBG));
+ EXPECT_EQ("ERR", logLevelToString(LogLevel::ERR));
+ EXPECT_EQ("CRITICAL", logLevelToString(LogLevel::CRITICAL));
+ EXPECT_EQ("DFATAL", logLevelToString(LogLevel::DFATAL));
+ EXPECT_EQ("FATAL", logLevelToString(LogLevel::FATAL));
+ EXPECT_EQ("FATAL", logLevelToString(LogLevel::MAX_LEVEL));
+
+ EXPECT_EQ("DBG0", logLevelToString(LogLevel::DBG0));
+ EXPECT_EQ("DBG2", logLevelToString(LogLevel::DBG2));
+ EXPECT_EQ("DBG5", logLevelToString(LogLevel::DBG5));
+ EXPECT_EQ("DBG9", logLevelToString(LogLevel::DBG9));
+ EXPECT_EQ("DBG97", logLevelToString(static_cast<LogLevel>(903)));
+ EXPECT_EQ("DBG64", logLevelToString(LogLevel::DBG4 - 60));
EXPECT_EQ("LogLevel(1234)", logLevelToString(static_cast<LogLevel>(1234)));
}
// Check all of the named levels
checkLevel(LogLevel::UNINITIALIZED);
checkLevel(LogLevel::NONE);
- checkLevel(LogLevel::DEBUG);
+ checkLevel(LogLevel::DBG);
checkLevel(LogLevel::DBG0);
checkLevel(LogLevel::DBG1);
checkLevel(LogLevel::DBG2);