Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: base/logging.cc

Issue 2377963002: restore LOG_FATAL crash key on windows
Patch Set: move CrashMessageHandler out of base Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/logging.h ('k') | blimp/engine/app/blimp_engine_crash_keys.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/logging.cc
diff --git a/base/logging.cc b/base/logging.cc
index 0771b47c182e5c18c868f1124a0784bf411d74a9..a14157a190bd277a924a3f777e3ca8845e4b0e5b 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -126,6 +126,8 @@ LogAssertHandlerFunction log_assert_handler = nullptr;
// A log message handler that gets notified of every log message we process.
LogMessageHandlerFunction log_message_handler = nullptr;
+CrashMessageHandlerFunction crash_message_handler = nullptr;
+
// Helper functions to wrap platform differences.
int32_t CurrentProcessId() {
@@ -451,6 +453,10 @@ LogMessageHandlerFunction GetLogMessageHandler() {
return log_message_handler;
}
+void SetCrashMessageHandler(CrashMessageHandlerFunction handler) {
+ crash_message_handler = handler;
+}
+
// Explicit instantiations for commonly used comparisons.
template std::string* MakeCheckOpString<int, int>(
const int&, const int&, const char* names);
@@ -537,6 +543,9 @@ LogMessage::~LogMessage() {
stream_ << std::endl;
std::string str_newline(stream_.str());
+ if (severity_ == LOG_FATAL && crash_message_handler)
+ crash_message_handler(str_newline.c_str() + message_start_);
+
// Give any log message handler first dibs on the message.
if (log_message_handler &&
log_message_handler(severity_, file_, line_,
« no previous file with comments | « base/logging.h ('k') | blimp/engine/app/blimp_engine_crash_keys.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698