diff options
Diffstat (limited to 'include/grpc/support/log.h')
-rw-r--r-- | include/grpc/support/log.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index ccb4b304cc..1837d4bd22 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -21,7 +21,6 @@ #include <grpc/impl/codegen/port_platform.h> -#include <inttypes.h> #include <stdarg.h> #include <stdlib.h> /* for abort() */ @@ -62,6 +61,8 @@ GPRAPI const char* gpr_log_severity_string(gpr_log_severity severity); GPRAPI void gpr_log(const char* file, int line, gpr_log_severity severity, const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5); +GPRAPI int gpr_should_log(gpr_log_severity severity); + GPRAPI void gpr_log_message(const char* file, int line, gpr_log_severity severity, const char* message); @@ -92,12 +93,18 @@ GPRAPI void gpr_set_log_function(gpr_log_func func); an exception in a higher-level language, consider returning error code. */ #define GPR_ASSERT(x) \ do { \ - if (!(x)) { \ + if (GPR_UNLIKELY(!(x))) { \ gpr_log(GPR_ERROR, "assertion failed: %s", #x); \ abort(); \ } \ } while (0) +#ifndef NDEBUG +#define GPR_DEBUG_ASSERT(x) GPR_ASSERT(x) +#else +#define GPR_DEBUG_ASSERT(x) +#endif + #ifdef __cplusplus } #endif |