|
|
|
@ -43,12 +43,11 @@ |
|
|
|
|
|
|
|
|
|
#define ABSL_RAW_LOG(severity, ...) \ |
|
|
|
|
do { \
|
|
|
|
|
constexpr const char* absl_raw_logging_internal_basename = \
|
|
|
|
|
::absl::raw_logging_internal::Basename(__FILE__, \
|
|
|
|
|
sizeof(__FILE__) - 1); \
|
|
|
|
|
::absl::raw_logging_internal::RawLog(ABSL_RAW_LOGGING_INTERNAL_##severity, \
|
|
|
|
|
absl_raw_logging_internal_basename, \
|
|
|
|
|
__LINE__, __VA_ARGS__); \
|
|
|
|
|
constexpr const char* absl_raw_log_internal_basename = \
|
|
|
|
|
::absl::raw_log_internal::Basename(__FILE__, sizeof(__FILE__) - 1); \
|
|
|
|
|
::absl::raw_log_internal::RawLog(ABSL_RAW_LOG_INTERNAL_##severity, \
|
|
|
|
|
absl_raw_log_internal_basename, __LINE__, \
|
|
|
|
|
__VA_ARGS__); \
|
|
|
|
|
} while (0) |
|
|
|
|
|
|
|
|
|
// Similar to CHECK(condition) << message, but for low-level modules:
|
|
|
|
@ -72,14 +71,14 @@ |
|
|
|
|
//
|
|
|
|
|
// The API is a subset of the above: each macro only takes two arguments. Use
|
|
|
|
|
// StrCat if you need to build a richer message.
|
|
|
|
|
#define ABSL_INTERNAL_LOG(severity, message) \ |
|
|
|
|
do { \
|
|
|
|
|
constexpr const char* absl_raw_logging_internal_filename = __FILE__; \
|
|
|
|
|
::absl::raw_logging_internal::internal_log_function( \
|
|
|
|
|
ABSL_RAW_LOGGING_INTERNAL_##severity, \
|
|
|
|
|
absl_raw_logging_internal_filename, __LINE__, message); \
|
|
|
|
|
if (ABSL_RAW_LOGGING_INTERNAL_##severity == ::absl::LogSeverity::kFatal) \
|
|
|
|
|
ABSL_INTERNAL_UNREACHABLE; \
|
|
|
|
|
#define ABSL_INTERNAL_LOG(severity, message) \ |
|
|
|
|
do { \
|
|
|
|
|
constexpr const char* absl_raw_log_internal_filename = __FILE__; \
|
|
|
|
|
::absl::raw_log_internal::internal_log_function( \
|
|
|
|
|
ABSL_RAW_LOG_INTERNAL_##severity, absl_raw_log_internal_filename, \
|
|
|
|
|
__LINE__, message); \
|
|
|
|
|
if (ABSL_RAW_LOG_INTERNAL_##severity == ::absl::LogSeverity::kFatal) \
|
|
|
|
|
ABSL_INTERNAL_UNREACHABLE; \
|
|
|
|
|
} while (0) |
|
|
|
|
|
|
|
|
|
#define ABSL_INTERNAL_CHECK(condition, message) \ |
|
|
|
@ -91,16 +90,16 @@ |
|
|
|
|
} \
|
|
|
|
|
} while (0) |
|
|
|
|
|
|
|
|
|
#define ABSL_RAW_LOGGING_INTERNAL_INFO ::absl::LogSeverity::kInfo |
|
|
|
|
#define ABSL_RAW_LOGGING_INTERNAL_WARNING ::absl::LogSeverity::kWarning |
|
|
|
|
#define ABSL_RAW_LOGGING_INTERNAL_ERROR ::absl::LogSeverity::kError |
|
|
|
|
#define ABSL_RAW_LOGGING_INTERNAL_FATAL ::absl::LogSeverity::kFatal |
|
|
|
|
#define ABSL_RAW_LOGGING_INTERNAL_LEVEL(severity) \ |
|
|
|
|
#define ABSL_RAW_LOG_INTERNAL_INFO ::absl::LogSeverity::kInfo |
|
|
|
|
#define ABSL_RAW_LOG_INTERNAL_WARNING ::absl::LogSeverity::kWarning |
|
|
|
|
#define ABSL_RAW_LOG_INTERNAL_ERROR ::absl::LogSeverity::kError |
|
|
|
|
#define ABSL_RAW_LOG_INTERNAL_FATAL ::absl::LogSeverity::kFatal |
|
|
|
|
#define ABSL_RAW_LOG_INTERNAL_LEVEL(severity) \ |
|
|
|
|
::absl::NormalizeLogSeverity(severity) |
|
|
|
|
|
|
|
|
|
namespace absl { |
|
|
|
|
ABSL_NAMESPACE_BEGIN |
|
|
|
|
namespace raw_logging_internal { |
|
|
|
|
namespace raw_log_internal { |
|
|
|
|
|
|
|
|
|
// Helper function to implement ABSL_RAW_LOG
|
|
|
|
|
// Logs format... at "severity" level, reporting it
|
|
|
|
@ -130,7 +129,7 @@ constexpr const char* Basename(const char* fname, int offset) { |
|
|
|
|
// TODO(gfalcon): Come up with a better name for this method.
|
|
|
|
|
bool RawLoggingFullySupported(); |
|
|
|
|
|
|
|
|
|
// Function type for a raw_logging customization hook for suppressing messages
|
|
|
|
|
// Function type for a raw_log customization hook for suppressing messages
|
|
|
|
|
// by severity, and for writing custom prefixes on non-suppressed messages.
|
|
|
|
|
//
|
|
|
|
|
// The installed hook is called for every raw log invocation. The message will
|
|
|
|
@ -139,7 +138,7 @@ bool RawLoggingFullySupported(); |
|
|
|
|
// also provided with an output buffer, where it can write a custom log message
|
|
|
|
|
// prefix.
|
|
|
|
|
//
|
|
|
|
|
// The raw_logging system does not allocate memory or grab locks. User-provided
|
|
|
|
|
// The raw_log system does not allocate memory or grab locks. User-provided
|
|
|
|
|
// hooks must avoid these operations, and must not throw exceptions.
|
|
|
|
|
//
|
|
|
|
|
// 'severity' is the severity level of the message being written.
|
|
|
|
@ -152,7 +151,7 @@ using LogFilterAndPrefixHook = bool (*)(absl::LogSeverity severity, |
|
|
|
|
const char* file, int line, char** buf, |
|
|
|
|
int* buf_size); |
|
|
|
|
|
|
|
|
|
// Function type for a raw_logging customization hook called to abort a process
|
|
|
|
|
// Function type for a raw_log customization hook called to abort a process
|
|
|
|
|
// when a FATAL message is logged. If the provided AbortHook() returns, the
|
|
|
|
|
// logging system will call abort().
|
|
|
|
|
//
|
|
|
|
@ -189,7 +188,7 @@ void RegisterLogFilterAndPrefixHook(LogFilterAndPrefixHook func); |
|
|
|
|
void RegisterAbortHook(AbortHook func); |
|
|
|
|
void RegisterInternalLogFunction(InternalLogFunction func); |
|
|
|
|
|
|
|
|
|
} // namespace raw_logging_internal
|
|
|
|
|
} // namespace raw_log_internal
|
|
|
|
|
ABSL_NAMESPACE_END |
|
|
|
|
} // namespace absl
|
|
|
|
|
|
|
|
|
|