boost::logging::formatter::named_spacer_t< convert, format_base, lock_resource > Struct Template Reference

Allows you to contain multiple formatters, and specify a spacer between them. You have a spacer string, and within it, you can escape your contained formatters. More...

Inheritance diagram for boost::logging::formatter::named_spacer_t< convert, format_base, lock_resource >:
[legend]
Collaboration diagram for boost::logging::formatter::named_spacer_t< convert, format_base, lock_resource >:
[legend]

List of all members.


Detailed Description

template<class convert = default_, class format_base = default_, class lock_resource = default_>
struct boost::logging::formatter::named_spacer_t< convert, format_base, lock_resource >

Allows you to contain multiple formatters, and specify a spacer between them. You have a spacer string, and within it, you can escape your contained formatters.

#include <boost/logging/format/formatter/named_spacer.hpp>

This allows you:

Example:

#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() ) 

g_l()->writer().add_formatter( formatter::named_spacer("[%index%] %time% (T%thread%) ")
        .add( "index", formatter::idx())
        .add( "thread", formatter::thread_id())
        .add( "time", formatter::time("$mm")) );

Assuming you'd use the above in code

int i = 1;
L_ << "this is so cool " << i++;
L_ << "this is so cool again " << i++;

You could have an output like this:

[1] 53 (T3536) this is so cool 1
[2] 54 (T3536) this is so cool again 2

Bug:
Use_tags.cpp example when on dedicated thread, fails with named_spacer. If using the old code, it works.
Examples:

using_tags.cpp.


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

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