Adds thread safety to logging