@@ -43,8 +43,9 @@ TEST(LogTest, Levels) {
4343 EXPECT_TRUE (olp::logging::Log::isEnabled (olp::logging::Level::Info));
4444 EXPECT_FALSE (olp::logging::Log::isEnabled (olp::logging::Level::Debug));
4545
46- olp::logging::Log::setLevel (olp::logging::Level:: Debug, " test1" );
46+ olp::logging::Log::setLevel (" Debug" , " test1" );
4747 olp::logging::Log::setLevel (olp::logging::Level::Warning, " test2" );
48+ olp::logging::Log::setLevel (" WrongLevel" , " test1" );
4849
4950 EXPECT_EQ (olp::logging::Level::Debug, olp::logging::Log::getLevel (" test1" ));
5051 EXPECT_EQ (olp::logging::Level::Warning, olp::logging::Log::getLevel (" test2" ));
@@ -73,6 +74,14 @@ TEST(LogTest, Levels) {
7374 EXPECT_FALSE (
7475 olp::logging::Log::isEnabled (olp::logging::Level::Debug, " test2" ));
7576
77+ olp::logging::Log::clearLevel (" " );
78+ EXPECT_EQ (olp::logging::Level::Debug, olp::logging::Log::getLevel (" test1" ));
79+ EXPECT_EQ (olp::porting::none, olp::logging::Log::getLevel (" test2" ));
80+ EXPECT_TRUE (
81+ olp::logging::Log::isEnabled (olp::logging::Level::Warning, " test2" ));
82+ EXPECT_FALSE (
83+ olp::logging::Log::isEnabled (olp::logging::Level::Debug, " test2" ));
84+
7685 olp::logging::Log::clearLevels ();
7786 EXPECT_EQ (olp::porting::none, olp::logging::Log::getLevel (" test1" ));
7887 EXPECT_EQ (olp::porting::none, olp::logging::Log::getLevel (" test2" ));
@@ -662,6 +671,22 @@ TEST(LogTest, LogLevelOff) {
662671 ++index;
663672}
664673
674+ TEST (LogTest, IsEnabled_ReturnsFalse_WhenLogLevelOff_) {
675+ auto appender = std::make_shared<testing::MockAppender>();
676+ olp::logging::Configuration configuration;
677+ configuration.addAppender (appender);
678+ EXPECT_TRUE (olp::logging::Log::configure (configuration));
679+
680+ EXPECT_FALSE (olp::logging::Log::isEnabled (olp::logging::Level::Off));
681+ olp::logging::Log::setLevel (olp::logging::Level::Off);
682+ EXPECT_FALSE (olp::logging::Log::isEnabled (olp::logging::Level::Off));
683+
684+ constexpr auto tag = " random tag" ;
685+ EXPECT_FALSE (olp::logging::Log::isEnabled (olp::logging::Level::Off, tag));
686+ olp::logging::Log::setLevel (olp::logging::Level::Off, tag);
687+ EXPECT_FALSE (olp::logging::Log::isEnabled (olp::logging::Level::Off, tag));
688+ }
689+
665690TEST (LogTest, ReConfigure) {
666691 auto appender1 = std::make_shared<testing::MockAppender>();
667692 auto appender2 = std::make_shared<testing::MockAppender>();
0 commit comments