How do I implement convenient logging without a Singleton?
First: the use of std::unique_ptr is unnecessary: void Log::LogMsg(std::string const& s) { static Log L; L.log(s); } Produces exactly the same lazy initialization and cleanup semantics without introducing all the syntax noise (and redundant test). Now that is out of the way… Your class is extremely simple. You might want to build a slightly more … Read more