summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 00:34:02 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 00:34:02 +0000
commit1ce41054be2a7a5e4ccdfc447f31a7a593583f69 (patch)
treed76f5faeb552f3dfc6a1c9c3842a993093a17b6d /base
parentac9a3d7124a1d04b0a2aa243f91a21e412796ffe (diff)
downloadchromium_src-1ce41054be2a7a5e4ccdfc447f31a7a593583f69.zip
chromium_src-1ce41054be2a7a5e4ccdfc447f31a7a593583f69.tar.gz
chromium_src-1ce41054be2a7a5e4ccdfc447f31a7a593583f69.tar.bz2
Flush logging output.
It gets buffered otherwise, which is inconvenient when trying to follow what's going on in the Chrome OS window manager. TEST=compiled and ran it Review URL: http://codereview.chromium.org/459001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/logging.cc29
1 files changed, 18 insertions, 11 deletions
diff --git a/base/logging.cc b/base/logging.cc
index e9cfc7a..af513be 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -360,6 +360,7 @@ void DisplayDebugMessage(const std::string& str) {
}
#else
fprintf(stderr, "%s\n", str.c_str());
+ fflush(stderr);
#endif
}
@@ -467,23 +468,28 @@ LogMessage::~LogMessage() {
logging_destination == LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG) {
#if defined(OS_WIN)
OutputDebugStringA(str_newline.c_str());
- if (severity_ >= kAlwaysPrintErrorLevel)
+ if (severity_ >= kAlwaysPrintErrorLevel) {
+#else
+ {
#endif
- // TODO(erikkay): this interferes with the layout tests since it grabs
- // stderr and stdout and diffs them against known data. Our info and warn
- // logs add noise to that. Ideally, the layout tests would set the log
- // level to ignore anything below error. When that happens, we should
- // take this fprintf out of the #else so that Windows users can benefit
- // from the output when running tests from the command-line. In the
- // meantime, we leave this in for Mac and Linux, but until this is fixed
- // they won't be able to pass any layout tests that have info or warn logs.
- // See http://b/1343647
- fprintf(stderr, "%s", str_newline.c_str());
+ // TODO(erikkay): this interferes with the layout tests since it grabs
+ // stderr and stdout and diffs them against known data. Our info and warn
+ // logs add noise to that. Ideally, the layout tests would set the log
+ // level to ignore anything below error. When that happens, we should
+ // take this fprintf out of the #else so that Windows users can benefit
+ // from the output when running tests from the command-line. In the
+ // meantime, we leave this in for Mac and Linux, but until this is fixed
+ // they won't be able to pass any layout tests that have info or warn
+ // logs. See http://b/1343647
+ fprintf(stderr, "%s", str_newline.c_str());
+ fflush(stderr);
+ }
} else if (severity_ >= kAlwaysPrintErrorLevel) {
// When we're only outputting to a log file, above a certain log level, we
// should still output to stderr so that we can better detect and diagnose
// problems with unit tests, especially on the buildbots.
fprintf(stderr, "%s", str_newline.c_str());
+ fflush(stderr);
}
// write to log file
@@ -530,6 +536,7 @@ LogMessage::~LogMessage() {
NULL);
#else
fprintf(log_file, "%s", str_newline.c_str());
+ fflush(log_file);
#endif
if (lock_log_file == LOCK_LOG_FILE) {