I have a base class e.g. "ProcessingThread", that has several derivations. Each derivation has a specific name, e.g. "DerivationOne", "DerivationTwo", ... Now it seems useful to me, to have a formatted output to console which prints something like:
[DerivationOne]: Action X took place!
[DerivationTwo]: Action Y took place!
[DerivationTwo]: Action Z took place!
Simultaneously it should write the stuff each to a derivation specific log file. I thought of a class, that can be called in the standard manner, e.g. "custom_out << "Write stuff" << std::endl;" and uses the single stream to generate two streams that one runs in console with formatting and second to a log file without formatting the name [name] in the front.
Is there a standard way of doing this? Maybe normal logger already support behaviour like this? Maybe I can derive from a std::stream somehow to accomplish this? What is the best (or at least a good) way?