MAID-512 Improve Log Performance

Tested this in OSX, Windows, and Linux. There should be no changes in behavior, other than performance increase when logging is enabled.

There are no tests for log, which is a bit concerning. If you want me to add some, let me know. It will be difficult, but it should be possible.