Use C++ stream-style output for logging.

Resolves #1091.  Right on the borderline of not-worth-it, but IMHO the debug logging code is too valuable to leave uncompiled.  This (naturally) plays better with the new C++ code going forward.