summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 05:03:24 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 05:03:24 +0000
commitd1ccc35a971671602f4b6745ae76d814fa08b144 (patch)
tree3c62ab12b63ad3454588e9e4547fddffe5f44c4a
parentd59b315cc7b1f662eb6d312311bf0d63fdeee40c (diff)
downloadchromium_src-d1ccc35a971671602f4b6745ae76d814fa08b144.zip
chromium_src-d1ccc35a971671602f4b6745ae76d814fa08b144.tar.gz
chromium_src-d1ccc35a971671602f4b6745ae76d814fa08b144.tar.bz2
print stack trace to stderr as well as to dialog.
Stacktrace info was shown only in dialog, and chromeos was not getting this as it does not have xmessage. Changed to include stacktrace to the log message before being printed to stderr. BUG=none TEST=none Review URL: http://codereview.chromium.org/1094012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42431 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/logging.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/base/logging.cc b/base/logging.cc
index fa98eb2..851bdcc 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -458,12 +458,17 @@ LogMessage::~LogMessage() {
if (severity_ < min_log_level)
return;
- std::string str_newline(stream_.str());
-#if defined(OS_WIN)
- str_newline.append("\r\n");
-#else
- str_newline.append("\n");
+#ifndef NDEBUG
+ if (severity_ == LOG_FATAL) {
+ // Include a stack trace on a fatal.
+ StackTrace trace;
+ stream_ << std::endl; // Newline to separate from log message.
+ trace.OutputToStream(&stream_);
+ }
#endif
+ stream_ << std::endl;
+ std::string str_newline(stream_.str());
+
// Give any log message handler first dibs on the message.
if (log_message_handler && log_message_handler(severity_, str_newline))
return;
@@ -565,13 +570,6 @@ LogMessage::~LogMessage() {
if (DebugUtil::BeingDebugged()) {
DebugUtil::BreakDebugger();
} else {
-#ifndef NDEBUG
- // Dump a stack trace on a fatal.
- StackTrace trace;
- stream_ << "\n"; // Newline to separate from log message.
- trace.OutputToStream(&stream_);
-#endif
-
if (log_assert_handler) {
// make a copy of the string for the handler out of paranoia
log_assert_handler(std::string(stream_.str()));