From e8be6ff65def1d77409d57126915565b0208aee6 Mon Sep 17 00:00:00 2001 From: tommi Date: Fri, 22 Apr 2016 01:22:24 -0700 Subject: [PATCH] Add last error to fatal error messages. This requires including logging.h, which in turn pointed out a problem with our 'LOG_TAG' macro, so that macro is now renamed. BUG= Review URL: https://codereview.webrtc.org/1911903002 Cr-Commit-Position: refs/heads/master@{#12464} --- webrtc/base/checks.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/webrtc/base/checks.cc b/webrtc/base/checks.cc index 49a31f29b9..d9dc8f2d63 100644 --- a/webrtc/base/checks.cc +++ b/webrtc/base/checks.cc @@ -22,11 +22,16 @@ #endif #if defined(WEBRTC_ANDROID) -#define LOG_TAG "rtc" +#define RTC_LOG_TAG "rtc" #include // NOLINT #endif +#if defined(WEBRTC_WIN) +#include +#endif + #include "webrtc/base/checks.h" +#include "webrtc/base/logging.h" #if defined(_MSC_VER) // Warning C4722: destructor never returns, potential memory leak. @@ -38,7 +43,7 @@ namespace rtc { void VPrintError(const char* format, va_list args) { #if defined(WEBRTC_ANDROID) - __android_log_vprint(ANDROID_LOG_ERROR, LOG_TAG, format, args); + __android_log_vprint(ANDROID_LOG_ERROR, RTC_LOG_TAG, format, args); #else vfprintf(stderr, format, args); #endif @@ -105,8 +110,11 @@ NO_RETURN FatalMessage::~FatalMessage() { } void FatalMessage::Init(const char* file, int line) { - stream_ << std::endl << std::endl << "#" << std::endl << "# Fatal error in " - << file << ", line " << line << std::endl << "# "; + stream_ << std::endl << std::endl + << "#" << std::endl + << "# Fatal error in " << file << ", line " << line << std::endl + << "# last system error: " << LAST_SYSTEM_ERROR << std::endl + << "# "; } // MSVC doesn't like complex extern templates and DLLs.