Improve logging performance