Thread Safe Simple Logger in C++11

This logger is an exercise in C++11 thread safety and a demonstration of Return Value Optimization (RVO)/Copy elision. Even though RVO behavior is not directly prescribed by the standard, most new compilers avoid unnecessary copies and destructor calls.

This code was tested on MSVC 2013 and on MinGW GCC 4.8.1 x64. Since RVO varies between different compilers and may be affected by compiler optimization flags, the code in this post is not guaranteed to work on all systems in its current state.

My ideal logger for small scale C++ projects should have a very simple usage as demonstrated below.

Read more