Guarded debug_log() calls with ifs.

This enables the compiler to completely eliminate the calls and
therefore sub-calls to .DebugString() etc.