boost::logging::destination::named_t< destination_base, lock_resource > Struct Template Reference

Allows you to contain multiple destinations, give each such destination a name. Then, at run-time, you can specify a format string which will specify which destinations to be called, and on what order. More...

Inheritance diagram for boost::logging::destination::named_t< destination_base, lock_resource >:
[legend]
Collaboration diagram for boost::logging::destination::named_t< destination_base, lock_resource >:
[legend]

List of all members.

Public Member Functions

 named_t (const string_type &format_string=string_type())
 constructs the named destination


Detailed Description

template<class destination_base = default_, class lock_resource = default_>
struct boost::logging::destination::named_t< destination_base, lock_resource >

Allows you to contain multiple destinations, give each such destination a name. Then, at run-time, you can specify a format string which will specify which destinations to be called, and on what order.

This allows you:

The format string contains destination names, separated by space.

When a message is written to this destination, I parse the format string. When a name is encountered, if there's a destination corresponding to this name, I will call it.

Example:

g_l()->writer().add_destination( 
    destination::named("cout out debug")
        .add( "cout", destination::cout())
        .add( "debug", destination::dbg_window() )
        .add( "out", destination::file("out.txt"))
     );

In the above code, we'll write to 3 destinations, in the following order:

you deal with config files

As an extra feature:

This is useful if you want to set this format string in a config file. The good thing is that this way you can easily turn on/off certain destinations, while seing all the available destinations as well.

Example:
+out_file -debug_window +console
In the above example, I know that the available destinations are out_file, debug_window and console, but I'm not writing to debug_window.

#include <boost/logging/format/destination/named.hpp>

Constructor & Destructor Documentation

template<class destination_base = default_, class lock_resource = default_>
boost::logging::destination::named_t< destination_base, lock_resource >::named_t ( const string_type &  format_string = string_type()  )  [inline]

constructs the named destination

Parameters:
named_name name of the named
set [optional] named settings - see named_settings class, and Dealing with flags.


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

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