Author: John Torjo, www.torjo.com
Copyright (C) 2007 John Torjo (see www.torjo.com for email)
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
See http://www.boost.org for updates, documentation, and revision history. See http://www.torjo.com/log2/ for more details
This usage:
Optimizations:
In this example, all output will be written to the console and debug window. It will be:
00001 00051 #include <boost/logging/format_fwd.hpp> 00052 00053 BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> ) 00054 00055 // FIXME need to set the gather class 00056 00057 #include <boost/logging/format.hpp> 00058 00059 using namespace boost::logging; 00060 00061 typedef logger_format_write< > logger_type; 00062 00063 BOOST_DECLARE_LOG_FILTER(g_log_filter, filter::no_ts ) 00064 BOOST_DECLARE_LOG(g_l, logger_type) 00065 00066 #define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) 00067 00068 BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts ) 00069 BOOST_DEFINE_LOG(g_l, logger_type) 00070 00071 00072 void use_tss_ostringstream_example() { 00073 // add formatters and destinations 00074 // That is, how the message is to be formatted and where should it be written to 00075 00076 g_l()->writer().add_formatter( formatter::idx(), "[%] " ); 00077 g_l()->writer().add_formatter( formatter::append_newline_if_needed() ); 00078 g_l()->writer().add_destination( destination::cout() ); 00079 g_l()->writer().add_destination( destination::dbg_window() ); 00080 g_l()->mark_as_initialized(); 00081 00082 int i = 1; 00083 L_ << "this is so cool " << i++; 00084 L_ << "this is so cool again " << i++; 00085 L_ << "this is so too cool " << i++; 00086 } 00087 00088 00089 00090 00091 int main() { 00092 use_tss_ostringstream_example(); 00093 } 00094 00095 00096 // End of file 00097