You want to format the message before it's written
The logger has several log destinations
The output goes to console and debug output window
Formatting - prefix each message by its index, and append newline
Optimizations:
use tss_ostringstream (each thread has its own ostringstream copy, to make writing faster: when logging of a message, we won't need to create the ostringstream first ; it's created only once per thread )
use a cache string (from optimize namespace), in order to make formatting the message faster
In this example, all output will be written to the console and debug window. It will be:
[1] this is so cool 1
[2] this is so cool again 2
[3] this is too cool 3