19 #ifndef ABSL_BASE_INTERNAL_RAW_LOGGING_H_ 20 #define ABSL_BASE_INTERNAL_RAW_LOGGING_H_ 42 #define ABSL_RAW_LOG(severity, ...) \ 44 constexpr const char* absl_raw_logging_internal_basename = \ 45 ::absl::raw_logging_internal::Basename(__FILE__, \ 46 sizeof(__FILE__) - 1); \ 47 ::absl::raw_logging_internal::RawLog(ABSL_RAW_LOGGING_INTERNAL_##severity, \ 48 absl_raw_logging_internal_basename, \ 49 __LINE__, __VA_ARGS__); \ 57 #define ABSL_RAW_CHECK(condition, message) \ 59 if (ABSL_PREDICT_FALSE(!(condition))) { \ 60 ABSL_RAW_LOG(FATAL, "Check %s failed: %s", #condition, message); \ 73 #define ABSL_INTERNAL_LOG(severity, message) \ 75 constexpr const char* absl_raw_logging_internal_basename = \ 76 ::absl::raw_logging_internal::Basename(__FILE__, \ 77 sizeof(__FILE__) - 1); \ 78 ::absl::raw_logging_internal::internal_log_function( \ 79 ABSL_RAW_LOGGING_INTERNAL_##severity, \ 80 absl_raw_logging_internal_basename, __LINE__, message); \ 83 #define ABSL_INTERNAL_CHECK(condition, message) \ 85 if (ABSL_PREDICT_FALSE(!(condition))) { \ 86 std::string death_message = "Check " #condition " failed: "; \ 87 death_message += std::string(message); \ 88 ABSL_INTERNAL_LOG(FATAL, death_message); \ 92 #define ABSL_RAW_LOGGING_INTERNAL_INFO ::absl::LogSeverity::kInfo 93 #define ABSL_RAW_LOGGING_INTERNAL_WARNING ::absl::LogSeverity::kWarning 94 #define ABSL_RAW_LOGGING_INTERNAL_ERROR ::absl::LogSeverity::kError 95 #define ABSL_RAW_LOGGING_INTERNAL_FATAL ::absl::LogSeverity::kFatal 96 #define ABSL_RAW_LOGGING_INTERNAL_LEVEL(severity) \ 97 ::absl::NormalizeLogSeverity(severity) 100 namespace raw_logging_internal {
119 constexpr
const char*
Basename(
const char* fname,
int offset) {
120 return offset == 0 || fname[offset - 1] ==
'/' || fname[offset - 1] ==
'\\' 152 int line,
char** buffer,
int* buf_size);
163 using AbortHook = void (*)(
const char* file,
int line,
const char* buf_start,
164 const char* prefix_end,
const char* buf_end);
171 const char* file,
int line,
172 const std::string& message);
181 #endif // ABSL_BASE_INTERNAL_RAW_LOGGING_H_ void SafeWriteToStderr(const char *s, size_t len)
constexpr const char * Basename(const char *fname, int offset)
void RegisterInternalLogFunction(InternalLogFunction func)
bool RawLoggingFullySupported()
bool(*)(absl::LogSeverity severity, const char *file, int line, char **buffer, int *buf_size) LogPrefixHook
base_internal::AtomicHook< InternalLogFunction > internal_log_function
std::string format(const std::string &, const time_point< seconds > &, const femtoseconds &, const time_zone &)
void RawLog(absl::LogSeverity severity, const char *file, int line, const char *format,...) ABSL_PRINTF_ATTRIBUTE(4
void(*)(absl::LogSeverity severity, const char *file, int line, const std::string &message) InternalLogFunction
#define ABSL_PRINTF_ATTRIBUTE(string_index, first_to_check)
void(*)(const char *file, int line, const char *buf_start, const char *prefix_end, const char *buf_end) AbortHook