void testFizzBuzzSequenceUpTo16() { std::ostringstream out; { FizzBuzz<> fb0(out); } ASSERT_EQUAL("",out.str()); }
int main() { // Create a sink for output std::shared_ptr<smlog::Sink> sink = std::make_shared<SinkToStdOut>(); // Create the log smlog::Logger log; log.AddSink(sink); // Add some prefix tokens for each log message std::unique_ptr<smlog::FBCustomStr> fb0( new smlog::FBCustomStr("TRACE: LIBNAME: " )); std::unique_ptr<smlog::FBCustomStr> fb1( new smlog::FBCustomStr("DEBUG: LIBNAME: " )); std::unique_ptr<smlog::FBCustomStr> fb2( new smlog::FBCustomStr("INFO: LIBNAME: " )); std::unique_ptr<smlog::FBCustomStr> fb3( new smlog::FBCustomStr("WARN: LIBNAME: " )); std::unique_ptr<smlog::FBCustomStr> fb4( new smlog::FBCustomStr("ERROR: LIBNAME: " )); std::unique_ptr<smlog::FBCustomStr> fb5( new smlog::FBCustomStr("FATAL: LIBNAME: " )); log.AddFormatBlock(std::move(fb0),smlog::Logger::Level::TRACE); log.AddFormatBlock(std::move(fb1),smlog::Logger::Level::DEBUG); log.AddFormatBlock(std::move(fb2),smlog::Logger::Level::INFO); log.AddFormatBlock(std::move(fb3),smlog::Logger::Level::WARN); log.AddFormatBlock(std::move(fb4),smlog::Logger::Level::ERROR); log.AddFormatBlock(std::move(fb5),smlog::Logger::Level::FATAL); testLog(log); // Test setting / unsetting log levels. All levels // are initially enabled by default log.UnsetLevel(smlog::Logger::Level::TRACE); log.UnsetLevel(smlog::Logger::Level::DEBUG); log.UnsetLevel(smlog::Logger::Level::WARN); std::cout << std::endl; testLog(log); log.SetLevel(smlog::Logger::Level::DEBUG); std::cout << std::endl; testLog(log); return 0; }