Well, yeah, it depends on what you want to log.
> collect all the buffers
Which requires some sort of synchronization (or lock-free data structures), because of concurrent writes by other threads. In that situation, you can also simply use a dedicated thread to periodically flush the log buffers.