// boostLogger.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include #include // logging::trivial::severity #include #include #include namespace sinks = boost::log::sinks; namespace expr = boost::log::expressions; int _tmain(int argc, _TCHAR* argv[]) { // Make a sink with a synchronous frontend and a streaming text backend typedef sinks::synchronous_sink< sinks::text_ostream_backend > text_sink; boost::shared_ptr< text_sink > sink = boost::make_shared< text_sink >( ); // Add a stream to write log to sink->locked_backend( )->add_stream( boost::make_shared< std::ofstream >( "sample.log" ) ); const int myWidth = 5; sink->set_formatter( expr::stream << std::setw( myWidth ) << "[ " << expr::attr< char >( "side" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< char >( "uplo" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< char >( "transa" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< char >( "transb" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< char >( "diag" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< int >( "M" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< int >( "N" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< int >( "K" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< float >( "alpha" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< float* >( "A" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< int >( "lda" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< float* >( "B" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< int >( "ldb" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< float >( "beta" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< float* >( "C" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< int >( "ldc" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< int >( "extra1" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< int >( "extra2" ) << " ] " << std::setw( myWidth ) << "[ " << expr::attr< int >( "extra3" ) << " ] " << expr::smessage ); return 0; }