Suppress logging when testing mass logging

This commit is contained in:
abitmore 2018-03-23 14:31:46 -04:00
parent f92671e1b5
commit 5dcebe7b1f

View file

@ -5,6 +5,7 @@
#include <fc/io/raw.hpp>
#include <fc/reflect/variant.hpp>
#include <fc/static_variant.hpp>
#include <fc/log/logger_config.hpp>
namespace fc { namespace test {
@ -48,6 +49,15 @@ BOOST_AUTO_TEST_SUITE(fc_variant_and_log)
BOOST_AUTO_TEST_CASE( nested_objects_test )
{ try {
ilog( "Suppressing logging (but not disabled)" );
fc::logging_config cfg;
fc::logger_config dlc;
dlc.name = "default";
dlc.level = fc::log_level::debug;
dlc.appenders.push_back("stderr");
cfg.loggers.push_back( dlc );
fc::configure_logging( cfg );
auto create_nested_object = []( uint32_t level )
{
ilog( "Creating nested object with ${lv} level(s)", ("lv",level) );
@ -166,6 +176,9 @@ BOOST_AUTO_TEST_CASE( nested_objects_test )
}
fc::configure_logging( fc::logging_config::default_config() );
ilog( "End suppressing logging" );
} FC_CAPTURE_LOG_AND_RETHROW ( (0) ) }
BOOST_AUTO_TEST_SUITE_END()