log buffers and static variables used in log functions are now thread-local. So there is no need to lock anything to log messages. Moreover, per-thread init/deinit functions are now used to initialize these buffers.