From e0d11ae476981fd56229b4ccffdd30166361548b Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 9 Apr 2014 22:15:25 +0000 Subject: Remove the global logging level. It's incompatible with having a logger that logs everything, regardless of the global log level. --- test/bbackupd/testbbackupd.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'test/bbackupd/testbbackupd.cpp') diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp index 28651233..827e3ea0 100644 --- a/test/bbackupd/testbbackupd.cpp +++ b/test/bbackupd/testbbackupd.cpp @@ -324,7 +324,7 @@ int test_basics() BackupClientFileAttributes t3; { - Logging::Guard guard(Log::ERROR); + Logger::LevelGuard(Logging::GetConsole(), Log::ERROR); TEST_CHECK_THROWS(t3.ReadAttributes("doesn't exist"), CommonException, OSFileError); } @@ -345,7 +345,7 @@ int test_basics() #ifndef WIN32 { - Logging::Guard guard(Log::ERROR); + Logger::LevelGuard(Logging::GetConsole(), Log::ERROR); TEST_CHECK_THROWS(t1.WriteAttributes("testfiles/test1_nXX"), CommonException, OSFileError); TEST_CHECK_THROWS(t3.WriteAttributes("doesn't exist"), @@ -879,7 +879,7 @@ int test_bbackupd() context, 0 /* read-write */); { - Logging::Guard guard(Log::ERROR); + Logger::LevelGuard(Logging::GetConsole(), Log::ERROR); TEST_CHECK_THROWS(ReadDirectory(*client, 0x12345678), ConnectionException, Conn_Protocol_UnexpectedReply); @@ -1713,11 +1713,6 @@ int test_bbackupd() // in fork child TEST_THAT(setsid() != -1); - if (!Logging::IsEnabled(Log::TRACE)) - { - Logging::SetGlobalLevel(Log::NOTHING); - } - // BackupStoreDaemon must be destroyed before exit(), // to avoid memory leaks being reported. { @@ -1742,15 +1737,14 @@ int test_bbackupd() ::signal(SIGPIPE, SIG_IGN); { - Log::Level newLevel = Logging::GetGlobalLevel(); + Console& console(Logging::GetConsole()); + Logger::LevelGuard guard(console); - if (!Logging::IsEnabled(Log::TRACE)) + if (console.GetLevel() < Log::TRACE) { - newLevel = Log::NOTHING; + console.Filter(Log::NOTHING); } - Logging::Guard guard(newLevel); - BackupDaemon bbackupd; bbackupd.Configure("testfiles/bbackupd.conf"); bbackupd.InitCrypto(); @@ -3424,7 +3418,8 @@ int test_bbackupd() fflush(stdout); { - Logging::Guard guard(Log::FATAL); + Logger::LevelGuard(Logging::GetConsole(), + Log::FATAL); TEST_THAT(BackupClientRestore(*client, restoredirid, "Test1", "testfiles/no-such-path/subdir", -- cgit v1.2.3