Optimizations:
In this example, all output will be written to the console and debug window. It will be:
00001 00036 #include <boost/logging/format_fwd.hpp> 00037 00038 BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> ) 00039 00040 // FIXME need to set the gather class 00041 00042 #include <boost/logging/format.hpp> 00043 00044 using namespace boost::logging; 00045 00046 typedef logger_format_write< > logger_type; 00047 00048 BOOST_DECLARE_LOG_FILTER(g_log_filter, filter::no_ts ) 00049 BOOST_DECLARE_LOG(g_l, logger_type) 00050 00051 #define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) 00052 00053 BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts ) 00054 BOOST_DEFINE_LOG(g_l, logger_type) 00055 00056 00057 void use_tss_ostringstream_example() { 00058 // add formatters and destinations 00059 // That is, how the message is to be formatted and where should it be written to 00060 00061 g_l()->writer().add_formatter( formatter::idx(), "[%] " ); 00062 g_l()->writer().add_formatter( formatter::append_newline_if_needed() ); 00063 g_l()->writer().add_destination( destination::cout() ); 00064 g_l()->writer().add_destination( destination::dbg_window() ); 00065 g_l()->mark_as_initialized(); 00066 00067 int i = 1; 00068 L_ << "this is so cool " << i++; 00069 L_ << "this is so cool again " << i++; 00070 L_ << "this is so too cool " << i++; 00071 } 00072 00073 00074 00075 00076 int main() { 00077 use_tss_ostringstream_example(); 00078 } 00079 00080 00081 // End of file 00082