no_levels_with_route.cpp Example

This usage:

A custom route means you don't want to first run all formatters, and then write to all destinations. Depending on the destination, you'll want a certain formatting of the message

In our example:

to cout:        [idx] [time] message [enter]
to dbg_window:  [time] message [enter]
to file:        [idx] message [enter]

We will use an apply_format_and_write class that caches the formatting, so that it'll format faster (more specifically, the boost::logging::format_and_write::use_cache, together with boost::logging::optimize::cache_string_several_str).

The output will be similar to this:

The debug window

12:15.12 this is so cool 1
12:15.12 hello, world
12:15.12 good to be back ;) 2

The file:

[1] this is so cool 1
[2] hello, world
[3] good to be back ;) 2

The console:

[1] 12:15.12 this is so cool 1
[2] 12:15.12 hello, world
[3] 12:15.12 good to be back ;) 2


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