boost::logging::msg_route::simple< formatter_base, destination_base, lock_resource > Struct Template Reference

Represents a simple router - first calls all formatters - in the order they were added, then all destinations - in the order they were added. More...

List of all members.


Detailed Description

template<class formatter_base, class destination_base, class lock_resource = default_>
struct boost::logging::msg_route::simple< formatter_base, destination_base, lock_resource >

Represents a simple router - first calls all formatters - in the order they were added, then all destinations - in the order they were added.

Example:

typedef logger< gather::ostream_like::return_str<> , format_write<...> > logger_type;
BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts ) 
BOOST_DEFINE_LOG(g_l, logger_type)
#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) 

// add formatters : [idx] [time] message [enter]
g_l()->writer().add_formatter( write_idx() );
g_l()->writer().add_formatter( write_time() );
g_l()->writer().add_formatter( append_newline() );

// write to cout and file
g_l()->writer().add_destination( write_to_cout() );
g_l()->writer().add_destination( write_to_file("out.txt") );

// usage
int i = 1;
L_ << "testing " << i << i+1 << i+2;

In the above case:

Parameters:
format_base The base class for all formatter classes from your application. See manipulator.
destination_base The base class for all destination classes from your application. See manipulator.
lock_resource_type What class you use to do allow thread-safe access to an instance of this clas (used internally).

The documentation for this struct was generated from the following file:

Copyright John Torjo © 2007
Have a question/ suggestion/ comment? Send me feedback