I have this code for some proprietary logger:
#define LOG GetStream()
Where GetStream returns an std::ostream. User will do:
LOG << "text";
I need this to be thread safe but would like to avoid this:
#define END Unlock();
#define LOG Lock(); GetStream() << "text" << END;
Since user will need to add the "END":
LOG << "Text" << END;
Any ideas?
Remark: I handle the carriage return using something like this.