Improve logger perf

An alternate to #311.