C++ Logging or a logger class that will print the log message with a custom prefix : I have a C++ project that has multiple classes. I want to streamline my logging process so that I can create some custom ostream object 'log' so that wherever I want to print a log message, I can write "log << my-message". The catch is that each of my class has a name (stored as a string) and I want the ostream object to prefix the name of the class before the log message. So the output would look like

name-of-class: my-message

How can I do this in C++?

I tried create a Logger class with a name variable, and then instantiating an object of that class in each of my classes, which will then set the class' name as the Logger object's name. But this approach cannot scale because once I concatenate multiple log messages, the name gets printed each time. 

I also tried using variadic templates/functions, but then I wasn't able to pass in arguments such as std::hex, std::endl etc.