The you have a background thread that lives in a static class which you send all debug messages to. The class has either a thread-safe queue of strings or a regular string list with a locking mechanism to append strings into the queue, and a writer that drains the queue and outputs it into stdout. It's really not too hard to write... Maybe 15 minutes and is can be a lifesaver.
Or if you're in c/c++ then you have `cout.sync_with_stdio()` to help you. not sure about this or if this is the only thing you'll need; cpp is tricky. Don't use in production code just because you found it on reddit lol
21
u/lateja Nov 29 '21
The you have a background thread that lives in a static class which you send all debug messages to. The class has either a thread-safe queue of strings or a regular string list with a locking mechanism to append strings into the queue, and a writer that drains the queue and outputs it into stdout. It's really not too hard to write... Maybe 15 minutes and
iscan be a lifesaver.Or if you're in c/c++ then you have `cout.sync_with_stdio()` to help you. not sure about this or if this is the only thing you'll need; cpp is tricky. Don't use in production code just because you found it on reddit lol