Use the logging module consistently to output messages.

When cbuildbot outputs informational messages, these messages should be
sent to the same place consistently. We've arbitrarily decided to send
the logging output to stderr, so I've output all places that output
informational messages to send them via the logging module.

Some places in cbuildbot that don't use the logging module:
  - builderstage.py, because it prints formatted strings, which would
    look ugly with the current formatting. This spot could probably be
    updated to use the logging module as well if we updated the
    formatting.
  - cbuildbot_background, because it's forwarding output from another
    process and can be used in programs other than cbuildbot. In this
    case I added a flush of stdout and stderr prior to starting output
    to prevent interleaving.

BUG=chromium-os:32648
TEST=Several remote trybot runs. All unit tests. Pylint on all changed files.

Change-Id: Ib03075e239cab8572ac6b5b4808fd0150d29ec71
Reviewed-on: https://gerrit.chromium.org/gerrit/27791
Commit-Ready: David James <davidjames@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 940e63b..11e1d9c 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -347,7 +347,8 @@
         success = results_lib.Results.BuildSucceededSoFar()
         if exception_thrown and success:
           success = False
-          print "\n" + constants.STEP_WARNINGS + """
+          cros_build_lib.PrintBuildbotStepWarnings()
+          print """\
 Exception thrown, but all stages marked successful. This is an internal error,
 because the stage that threw the exception should be marked as failing."""