-//
-// Copyright (C) 1999 and onwards Google, Inc.
+// Copyright (c) 1999, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: Ray Sidney
//
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
-# ifdef _WIN32
+# if defined(_WIN32) && !defined(__CYGWIN__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
# endif
#endif
+#if defined(_MSC_VER)
+#define GLOG_MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \
+ __pragma(warning(disable:n))
+#define GLOG_MSVC_POP_WARNING() __pragma(warning(pop))
+#else
+#define GLOG_MSVC_PUSH_DISABLE_WARNING(n)
+#define GLOG_MSVC_POP_WARNING()
+#endif
// We care a lot about number of bits things take up. Unfortunately,
// systems define their bit-specific ints in a lot of different ways.
// You can also do occasional logging (log every n'th occurrence of an
// event):
//
-// LOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie";
+// LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
//
// The above will cause log messages to be output on the 1st, 11th, 21st, ...
-// times it is executed. Note that the special COUNTER value is used to
-// identify which repetition is happening.
+// times it is executed. Note that the special google::COUNTER value is used
+// to identify which repetition is happening.
//
// You can also do occasional conditional logging (log every n'th
// occurrence of an event, when condition is satisfied):
//
-// LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << COUNTER
+// LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
// << "th big cookie";
//
// You can log messages the first N times your code executes a line. E.g.
//
-// LOG_FIRST_N(INFO, 20) << "Got the " << COUNTER << "th cookie";
+// LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie";
//
// Outputs log messages for the first 20 times it is executed.
//
//
// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
//
-// DLOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie";
+// DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
//
// All "debug mode" logging is compiled away to nothing for non-debug mode
// compiles.
// "program with --v=1 or more";
// VLOG_EVERY_N(1, 10)
// << "I'm printed every 10th occurrence, and when you run the program "
-// "with --v=1 or more. Present occurence is " << COUNTER;
+// "with --v=1 or more. Present occurence is " << google::COUNTER;
// VLOG_IF_EVERY_N(1, (size > 1024), 10)
// << "I'm printed on every 10th occurence of case when size is more "
// " than 1024, when you run the program with --v=1 or more. ";
-// "Present occurence is " << COUNTER;
+// "Present occurence is " << google::COUNTER;
//
// The supported severity levels for macros that allow you to specify one
// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
#define COMPACT_GOOGLE_LOG_INFO @ac_google_namespace@::LogMessage( \
__FILE__, __LINE__)
#define LOG_TO_STRING_INFO(message) @ac_google_namespace@::LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::INFO, message)
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_INFO, message)
#else
#define COMPACT_GOOGLE_LOG_INFO @ac_google_namespace@::NullStream()
#define LOG_TO_STRING_INFO(message) @ac_google_namespace@::NullStream()
#if GOOGLE_STRIP_LOG <= 1
#define COMPACT_GOOGLE_LOG_WARNING @ac_google_namespace@::LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::WARNING)
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING)
#define LOG_TO_STRING_WARNING(message) @ac_google_namespace@::LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::WARNING, message)
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING, message)
#else
#define COMPACT_GOOGLE_LOG_WARNING @ac_google_namespace@::NullStream()
#define LOG_TO_STRING_WARNING(message) @ac_google_namespace@::NullStream()
#if GOOGLE_STRIP_LOG <= 2
#define COMPACT_GOOGLE_LOG_ERROR @ac_google_namespace@::LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::ERROR)
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR)
#define LOG_TO_STRING_ERROR(message) @ac_google_namespace@::LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::ERROR, message)
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, message)
#else
#define COMPACT_GOOGLE_LOG_ERROR @ac_google_namespace@::NullStream()
#define LOG_TO_STRING_ERROR(message) @ac_google_namespace@::NullStream()
#define COMPACT_GOOGLE_LOG_FATAL @ac_google_namespace@::LogMessageFatal( \
__FILE__, __LINE__)
#define LOG_TO_STRING_FATAL(message) @ac_google_namespace@::LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::FATAL, message)
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL, message)
#else
#define COMPACT_GOOGLE_LOG_FATAL @ac_google_namespace@::NullStreamFatal()
#define LOG_TO_STRING_FATAL(message) @ac_google_namespace@::NullStreamFatal()
#ifdef NDEBUG
#define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_ERROR
#elif GOOGLE_STRIP_LOG <= 3
-#define COMPACT_GOOGLE_LOG_DFATAL LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::FATAL)
+#define COMPACT_GOOGLE_LOG_DFATAL @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL)
#else
#define COMPACT_GOOGLE_LOG_DFATAL @ac_google_namespace@::NullStreamFatal()
#endif
-#define GOOGLE_LOG_INFO(counter) @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::INFO, counter, &@ac_google_namespace@::LogMessage::SendToLog)
+#define GOOGLE_LOG_INFO(counter) @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_INFO, counter, &@ac_google_namespace@::LogMessage::SendToLog)
#define SYSLOG_INFO(counter) \
- @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::INFO, counter, \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_INFO, counter, \
&@ac_google_namespace@::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_WARNING(counter) \
- @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::WARNING, counter, \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING, counter, \
&@ac_google_namespace@::LogMessage::SendToLog)
#define SYSLOG_WARNING(counter) \
- @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::WARNING, counter, \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING, counter, \
&@ac_google_namespace@::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_ERROR(counter) \
- @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::ERROR, counter, \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, counter, \
&@ac_google_namespace@::LogMessage::SendToLog)
#define SYSLOG_ERROR(counter) \
- @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::ERROR, counter, \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, counter, \
&@ac_google_namespace@::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_FATAL(counter) \
- @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::FATAL, counter, \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL, counter, \
&@ac_google_namespace@::LogMessage::SendToLog)
#define SYSLOG_FATAL(counter) \
- @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::FATAL, counter, \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL, counter, \
&@ac_google_namespace@::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_DFATAL(counter) \
@ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::DFATAL_LEVEL, counter, \
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) || defined(__CYGWIN32__)
// A very useful logging macro to log windows errors:
#define LOG_SYSRESULT(result) \
- if (FAILED(result)) { \
- LPTSTR message = NULL; \
- LPTSTR msg = reinterpret_cast<LPTSTR>(&message); \
- DWORD message_length = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | \
+ if (FAILED(HRESULT_FROM_WIN32(result))) { \
+ LPSTR message = NULL; \
+ LPSTR msg = reinterpret_cast<LPSTR>(&message); \
+ DWORD message_length = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | \
FORMAT_MESSAGE_FROM_SYSTEM, \
0, result, 0, msg, 100, NULL); \
if (message_length > 0) { \
- @ac_google_namespace@::LogMessage(__FILE__, __LINE__, ERROR, 0, \
- &@ac_google_namespace@::LogMessage::SendToLog).stream() << message; \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, 0, \
+ &@ac_google_namespace@::LogMessage::SendToLog).stream() \
+ << reinterpret_cast<const char*>(message); \
LocalFree(message); \
} \
}
// specified by argv0 in log outputs.
GOOGLE_GLOG_DLL_DECL void InitGoogleLogging(const char* argv0);
+// Shutdown google's logging library.
+GOOGLE_GLOG_DLL_DECL void ShutdownGoogleLogging();
+
// Install a function which will be called after LOG(FATAL).
GOOGLE_GLOG_DLL_DECL void InstallFailureFunction(void (*fail_func)());
#define LOG_TO_SINK(sink, severity) \
@ac_google_namespace@::LogMessage( \
__FILE__, __LINE__, \
- @ac_google_namespace@::severity, \
+ @ac_google_namespace@::GLOG_ ## severity, \
static_cast<@ac_google_namespace@::LogSink*>(sink), true).stream()
#define LOG_TO_SINK_BUT_NOT_TO_LOGFILE(sink, severity) \
@ac_google_namespace@::LogMessage( \
__FILE__, __LINE__, \
- @ac_google_namespace@::severity, \
+ @ac_google_namespace@::GLOG_ ## severity, \
static_cast<@ac_google_namespace@::LogSink*>(sink), false).stream()
// If a non-NULL string pointer is given, we write this message to that string.
// This declaration will allow use to use CHECK macros for user
// defined classes which have operator<< (e.g., stl_logging.h).
inline std::ostream& operator<<(
- std::ostream& out, const google::DummyClassToDefineOperator& dummy) {
+ std::ostream& out, const google::DummyClassToDefineOperator&) {
return out;
}
#endif
std::strstream ss;
ss << names << " (" << v1 << " vs. " << v2 << ")";
- return new std::string(ss.str(), ss.pcount());
+ return new std::string(ss.str(), static_cast<unsigned int>(ss.pcount()));
}
// Helper functions for CHECK_OP macro.
// file is included). Save the current meaning now and use it
// in the macro.
typedef std::string _Check_string;
-#define CHECK_OP_LOG(name, op, val1, val2, log) \
+#define CHECK_OP_LOG(name, op, val1, val2, log) \
while (@ac_google_namespace@::_Check_string* _result = \
@ac_google_namespace@::Check##name##Impl( \
@ac_google_namespace@::GetReferenceableValue(val1), \
#else
// In optimized mode, use CheckOpString to hint to compiler that
// the while condition is unlikely.
-#define CHECK_OP_LOG(name, op, val1, val2, log) \
- while (@ac_google_namespace@::CheckOpString _result = \
- @ac_google_namespace@::Check##name##Impl(GetReferenceableValue(val1), \
- GetReferenceableValue(val2), \
- #val1 " " #op " " #val2)) \
+#define CHECK_OP_LOG(name, op, val1, val2, log) \
+ while (@ac_google_namespace@::CheckOpString _result = \
+ @ac_google_namespace@::Check##name##Impl( \
+ @ac_google_namespace@::GetReferenceableValue(val1), \
+ @ac_google_namespace@::GetReferenceableValue(val2), \
+ #val1 " " #op " " #val2)) \
log(__FILE__, __LINE__, _result).stream()
#endif // STATIC_ANALYSIS, !NDEBUG
#define GOOGLE_PLOG(severity, counter) \
@ac_google_namespace@::ErrnoLogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::severity, counter, \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, counter, \
&@ac_google_namespace@::LogMessage::SendToLog)
#define PLOG_IF(severity, condition) \
if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
if (LOG_OCCURRENCES_MOD_N == 1) \
@ac_google_namespace@::LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
#define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
if (condition && \
((LOG_OCCURRENCES_MOD_N=(LOG_OCCURRENCES_MOD_N + 1) % n) == (1 % n))) \
@ac_google_namespace@::LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
#define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
if (LOG_OCCURRENCES_MOD_N == 1) \
@ac_google_namespace@::ErrnoLogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
#define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
++LOG_OCCURRENCES; \
if (LOG_OCCURRENCES <= n) \
@ac_google_namespace@::LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
namespace glog_internal_namespace_ {
template <bool>
struct CompileAssert {
};
+struct CrashReason;
} // namespace glog_internal_namespace_
#define GOOGLE_GLOG_COMPILE_ASSERT(expr, msg) \
typedef @ac_google_namespace@::glog_internal_namespace_::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
#define LOG_EVERY_N(severity, n) \
- GOOGLE_GLOG_COMPILE_ASSERT(@ac_google_namespace@::severity < \
+ GOOGLE_GLOG_COMPILE_ASSERT(@ac_google_namespace@::GLOG_ ## severity < \
@ac_google_namespace@::NUM_SEVERITIES, \
INVALID_REQUESTED_LOG_SEVERITY); \
SOME_KIND_OF_LOG_EVERY_N(severity, (n), @ac_google_namespace@::LogMessage::SendToLog)
// We want the special COUNTER value available for LOG_EVERY_X()'ed messages
enum PRIVATE_Counter {COUNTER};
+#ifdef GLOG_NO_ABBREVIATED_SEVERITIES
+// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
+// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
+// to keep using this syntax, we define this macro to do the same thing
+// as COMPACT_GOOGLE_LOG_ERROR.
+#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR
+#define SYSLOG_0 SYSLOG_ERROR
+#define LOG_TO_STRING_0 LOG_TO_STRING_ERROR
+// Needed for LOG_IS_ON(ERROR).
+const LogSeverity GLOG_0 = GLOG_ERROR;
+#else
+// Users may include windows.h after logging.h without
+// GLOG_NO_ABBREVIATED_SEVERITIES nor WIN32_LEAN_AND_MEAN.
+// For this case, we cannot detect if ERROR is defined before users
+// actually use ERROR. Let's make an undefined symbol to warn users.
+# define GLOG_ERROR_MSG ERROR_macro_is_defined_Define_GLOG_NO_ABBREVIATED_SEVERITIES_before_including_logging_h_See_the_document_for_detail
+# define COMPACT_GOOGLE_LOG_0 GLOG_ERROR_MSG
+# define SYSLOG_0 GLOG_ERROR_MSG
+# define LOG_TO_STRING_0 GLOG_ERROR_MSG
+# define GLOG_0 GLOG_ERROR_MSG
+#endif
// Plus some debug-logging macros that get compiled to nothing for production
#define DCHECK_LT(val1, val2) CHECK_LT(val1, val2)
#define DCHECK_GE(val1, val2) CHECK_GE(val1, val2)
#define DCHECK_GT(val1, val2) CHECK_GT(val1, val2)
+#define DCHECK_NOTNULL(val) CHECK_NOTNULL(val)
#define DCHECK_STREQ(str1, str2) CHECK_STREQ(str1, str2)
#define DCHECK_STRCASEEQ(str1, str2) CHECK_STRCASEEQ(str1, str2)
#define DCHECK_STRNE(str1, str2) CHECK_STRNE(str1, str2)
#define DLOG_ASSERT(condition) \
true ? (void) 0 : LOG_ASSERT(condition)
+// MSVC warning C4127: conditional expression is constant
#define DCHECK(condition) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK(condition)
+ GLOG_MSVC_POP_WARNING() CHECK(condition)
#define DCHECK_EQ(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK_EQ(val1, val2)
+ GLOG_MSVC_POP_WARNING() CHECK_EQ(val1, val2)
#define DCHECK_NE(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK_NE(val1, val2)
+ GLOG_MSVC_POP_WARNING() CHECK_NE(val1, val2)
#define DCHECK_LE(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK_LE(val1, val2)
+ GLOG_MSVC_POP_WARNING() CHECK_LE(val1, val2)
#define DCHECK_LT(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK_LT(val1, val2)
+ GLOG_MSVC_POP_WARNING() CHECK_LT(val1, val2)
#define DCHECK_GE(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK_GE(val1, val2)
+ GLOG_MSVC_POP_WARNING() CHECK_GE(val1, val2)
#define DCHECK_GT(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK_GT(val1, val2)
+ GLOG_MSVC_POP_WARNING() CHECK_GT(val1, val2)
+
+#define DCHECK_NOTNULL(val) (val)
#define DCHECK_STREQ(str1, str2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK_STREQ(str1, str2)
+ GLOG_MSVC_POP_WARNING() CHECK_STREQ(str1, str2)
#define DCHECK_STRCASEEQ(str1, str2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK_STRCASEEQ(str1, str2)
+ GLOG_MSVC_POP_WARNING() CHECK_STRCASEEQ(str1, str2)
#define DCHECK_STRNE(str1, str2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK_STRNE(str1, str2)
+ GLOG_MSVC_POP_WARNING() CHECK_STRNE(str1, str2)
#define DCHECK_STRCASENE(str1, str2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
while (false) \
- CHECK_STRCASENE(str1, str2)
-
+ GLOG_MSVC_POP_WARNING() CHECK_STRCASENE(str1, str2)
#endif // NDEBUG
# pragma warning(default: 4275)
#endif
public:
- LogStream(char *buf, int len, int ctr)
+ LogStream(char *buf, int len, int ctr_in)
: ostrstream(buf, len),
- ctr_(ctr) {
+ ctr_(ctr_in) {
self_ = this;
}
int ctr() const { return ctr_; }
- void set_ctr(int ctr) { ctr_ = ctr; }
+ void set_ctr(int ctr_in) { ctr_ = ctr_in; }
LogStream* self() const { return self_; }
private:
void Init(const char* file, int line, LogSeverity severity,
void (LogMessage::*send_method)());
+ // Used to fill in crash information during LOG(FATAL) failures.
+ void RecordCrashReason(glog_internal_namespace_::CrashReason* reason);
+
// Counts of messages sent at each priority:
static int64 num_messages_[NUM_SEVERITIES]; // under log_mutex
// version since there are two advantages: 1. this version outputs the
// file name and the line number where this macro is put like other
// LOG macros, 2. this macro can be used as C++ stream.
-#define LOG_AT_LEVEL(severity) LogMessage(__FILE__, __LINE__, severity).stream()
+#define LOG_AT_LEVEL(severity) @ac_google_namespace@::LogMessage(__FILE__, __LINE__, severity).stream()
// A small helper for CHECK_NOTNULL().
template <typename T>
// converted to LogStream and the message will be computed and then
// quietly discarded.
template<class T>
-inline NullStream& operator<<(NullStream &str, const T &value) { return str; }
+inline NullStream& operator<<(NullStream &str, const T &) { return str; }
// Similar to NullStream, but aborts the program (without stack
// trace), like LogMessageFatal.