Public Member Functions | |
virtual void | configure (const hold_string_type &) |
Override this if you want to allow configuration through scripting. |
A generic manipulator is one that does not derive from any formatter_base or destination_base class (Specifying the base class).
Libraries, such as this one, can provide generic manipulators, and they can't rely on any base class - since it's you, the user, who can choose which is the base class.
A generic manipulator has no way of knowing the type of the msg you pass on operator(). Thus, usually generic manipulators have a templated operator=, and do the best to convert what's in, to what they need.
Example:
template<class convert_dest = do_convert_destination > struct cout { template<class msg_type> void operator()(const msg_type & msg) const { convert_dest::write(msg, std::cout); } };
As long as exists a conversion function from your msg_type
to what the manipulator needs, it all works. Thus, no matter what your formatter base class or destination base class is, the code will still work. You can add your formatter/ destination classes, and the generic formatter/ destination classes
typedef ... formatter_base; logger< format_write<...> > g_l(); struct my_cool_formatter : formatter_base { ... }; // adding formatter class from the Logging lib g_l().add_formatter( formatter::thread_id() ); // adding formatter class defined by you g_l().add_formatter( my_cool_formatter() );
virtual void boost::logging::manipulator::is_generic::configure | ( | const hold_string_type & | ) | [inline, virtual] |
Override this if you want to allow configuration through scripting.
That is, this allows configuration of your manipulator (formatter/destination) at run-time.
Reimplemented in boost::logging::destination::file_t< convert_dest >, boost::logging::destination::rolling_file_t< convert_dest >, boost::logging::formatter::high_precision_time_t< convert >, and boost::logging::formatter::time_t< convert >.