I have to implement a threadsafe logging mechanism in C++ under Windows and I want to use the streams library.
I wanted to know if anyone could give me some advice regarding doing this and what would be the best way?
The logging messages will most likely be a few lines long each time, so I'd probably need to write them to a buffer first and then flush to file?
This logging should be fairly fast and not affect the performance of the application too much when its used, so I was thinking of doing the actual writing to the file in its own thread. Is that a good idea?
Any advice and hints are appreciated.