App-LabRecorder icon indicating copy to clipboard operation
App-LabRecorder copied to clipboard

Clean up the writing of recording messages.

Open kowalej opened this issue 7 years ago • 2 comments

Since some messages such as "Offsets thread is finished.", "Received header for stream ", etc, are being outputted from multiple threads, they show up looking a mess inside a console window, especially when one has multiple LSL streams running. Perhaps you can lock a new "output mutex" when doing calls to cout and cerr to make sure the messages look nice.

kowalej avatar Dec 14 '18 08:12 kowalej

So far I haven't had that issue personally, but I mostly have less than 10 streams and maybe my libstdc++ is less prone to it than others.

My suggestion: create a logging function (void log(const std::string& msg)) that locks a mutex internally. That way we can also enable callbacks to a logging function later on more easily. Is this something you'd be comfortable preparing a PR for?

tstenner avatar Dec 14 '18 09:12 tstenner

Yep that's exactly what I was thinking. I can do a PR for it pretty soon. For reference this messy message issue was seen on multiple different Windows 10 machines in both CMD and PowerShell outputs.

kowalej avatar Dec 14 '18 19:12 kowalej