Conditionally disable logging during compilation.

Logging is now disabled by default, use -DDEBUG to enable. Having logging turned
off results in ~80% performance boost according to a profiling sample size of 2,
so it seems to be a good idea.
Merge remote-tracking branch 'github/master'