Logger::setLevel(string) - optionally parse log level as number in range 1 to 8

This commit is contained in:
Marian Krivos
2014-12-07 20:39:00 +01:00
parent 8296d47cea
commit 0139648c46
2 changed files with 35 additions and 1 deletions

View File

@@ -142,6 +142,28 @@ void LoggerTest::testLogger()
pChannel->list().clear();
root.fatal("fatal");
assert (pChannel->list().begin()->getPriority() == Message::PRIO_FATAL);
root.setLevel("1");
assert (root.getLevel() == Message::PRIO_FATAL);
root.setLevel("8");
assert (root.getLevel() == Message::PRIO_TRACE);
try
{
root.setLevel("0");
assert(0);
}
catch(Poco::InvalidArgumentException&)
{
}
try
{
root.setLevel("9");
assert(0);
}
catch(Poco::InvalidArgumentException&)
{
}
}