diff options
author | Andy Getzendanner <durandal@google.com> | 2023-05-19 18:53:34 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-05-19 18:54:21 -0700 |
commit | 68be7315913c8ef8a791a0fb60d98e98787d88b6 (patch) | |
tree | 9a5b3fec68e69ec6c37e28db407ba04872626440 /absl/log/log.h | |
parent | 15d26cdd0179f83b328f3b62ae7d08388ffeef0b (diff) |
Rename ABSL_*_IMPL macros to match the other ABSL_LOG_INTERNAL_* macros and to make sure it's clear that they're internal.
Also rename the log and check test files from .h to .inc per https://google.github.io/styleguide/cppguide.html#Self_contained_Headers.
PiperOrigin-RevId: 533603350
Change-Id: Iad5d8b683e33b63784cc8e64b84da09f5fc3bf1e
Diffstat (limited to 'absl/log/log.h')
-rw-r--r-- | absl/log/log.h | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/absl/log/log.h b/absl/log/log.h index e060a0b6..602b5acf 100644 --- a/absl/log/log.h +++ b/absl/log/log.h @@ -196,29 +196,32 @@ // Example: // // LOG(INFO) << "Found " << num_cookies << " cookies"; -#define LOG(severity) ABSL_LOG_IMPL(_##severity) +#define LOG(severity) ABSL_LOG_INTERNAL_LOG_IMPL(_##severity) // PLOG() // // `PLOG` behaves like `LOG` except that a description of the current state of // `errno` is appended to the streamed message. -#define PLOG(severity) ABSL_PLOG_IMPL(_##severity) +#define PLOG(severity) ABSL_LOG_INTERNAL_PLOG_IMPL(_##severity) // DLOG() // // `DLOG` behaves like `LOG` in debug mode (i.e. `#ifndef NDEBUG`). Otherwise // it compiles away and does nothing. Note that `DLOG(FATAL)` does not // terminate the program if `NDEBUG` is defined. -#define DLOG(severity) ABSL_DLOG_IMPL(_##severity) +#define DLOG(severity) ABSL_LOG_INTERNAL_DLOG_IMPL(_##severity) // `LOG_IF` and friends add a second argument which specifies a condition. If // the condition is false, nothing is logged. // Example: // // LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; -#define LOG_IF(severity, condition) ABSL_LOG_IF_IMPL(_##severity, condition) -#define PLOG_IF(severity, condition) ABSL_PLOG_IF_IMPL(_##severity, condition) -#define DLOG_IF(severity, condition) ABSL_DLOG_IF_IMPL(_##severity, condition) +#define LOG_IF(severity, condition) \ + ABSL_LOG_INTERNAL_LOG_IF_IMPL(_##severity, condition) +#define PLOG_IF(severity, condition) \ + ABSL_LOG_INTERNAL_PLOG_IF_IMPL(_##severity, condition) +#define DLOG_IF(severity, condition) \ + ABSL_LOG_INTERNAL_DLOG_IF_IMPL(_##severity, condition) // LOG_EVERY_N // @@ -231,21 +234,24 @@ // // LOG_EVERY_N(WARNING, 1000) << "Got a packet with a bad CRC (" << COUNTER // << " total)"; -#define LOG_EVERY_N(severity, n) ABSL_LOG_EVERY_N_IMPL(_##severity, n) +#define LOG_EVERY_N(severity, n) \ + ABSL_LOG_INTERNAL_LOG_EVERY_N_IMPL(_##severity, n) // LOG_FIRST_N // // `LOG_FIRST_N` behaves like `LOG_EVERY_N` except that the specified message is // logged when the counter's value is less than `n`. `LOG_FIRST_N` is // thread-safe. -#define LOG_FIRST_N(severity, n) ABSL_LOG_FIRST_N_IMPL(_##severity, n) +#define LOG_FIRST_N(severity, n) \ + ABSL_LOG_INTERNAL_LOG_FIRST_N_IMPL(_##severity, n) // LOG_EVERY_POW_2 // // `LOG_EVERY_POW_2` behaves like `LOG_EVERY_N` except that the specified // message is logged when the counter's value is a power of 2. // `LOG_EVERY_POW_2` is thread-safe. -#define LOG_EVERY_POW_2(severity) ABSL_LOG_EVERY_POW_2_IMPL(_##severity) +#define LOG_EVERY_POW_2(severity) \ + ABSL_LOG_INTERNAL_LOG_EVERY_POW_2_IMPL(_##severity) // LOG_EVERY_N_SEC // @@ -257,19 +263,25 @@ // // LOG_EVERY_N_SEC(INFO, 2.5) << "Got " << COUNTER << " cookies so far"; #define LOG_EVERY_N_SEC(severity, n_seconds) \ - ABSL_LOG_EVERY_N_SEC_IMPL(_##severity, n_seconds) + ABSL_LOG_INTERNAL_LOG_EVERY_N_SEC_IMPL(_##severity, n_seconds) -#define PLOG_EVERY_N(severity, n) ABSL_PLOG_EVERY_N_IMPL(_##severity, n) -#define PLOG_FIRST_N(severity, n) ABSL_PLOG_FIRST_N_IMPL(_##severity, n) -#define PLOG_EVERY_POW_2(severity) ABSL_PLOG_EVERY_POW_2_IMPL(_##severity) +#define PLOG_EVERY_N(severity, n) \ + ABSL_LOG_INTERNAL_PLOG_EVERY_N_IMPL(_##severity, n) +#define PLOG_FIRST_N(severity, n) \ + ABSL_LOG_INTERNAL_PLOG_FIRST_N_IMPL(_##severity, n) +#define PLOG_EVERY_POW_2(severity) \ + ABSL_LOG_INTERNAL_PLOG_EVERY_POW_2_IMPL(_##severity) #define PLOG_EVERY_N_SEC(severity, n_seconds) \ - ABSL_PLOG_EVERY_N_SEC_IMPL(_##severity, n_seconds) + ABSL_LOG_INTERNAL_PLOG_EVERY_N_SEC_IMPL(_##severity, n_seconds) -#define DLOG_EVERY_N(severity, n) ABSL_DLOG_EVERY_N_IMPL(_##severity, n) -#define DLOG_FIRST_N(severity, n) ABSL_DLOG_FIRST_N_IMPL(_##severity, n) -#define DLOG_EVERY_POW_2(severity) ABSL_DLOG_EVERY_POW_2_IMPL(_##severity) +#define DLOG_EVERY_N(severity, n) \ + ABSL_LOG_INTERNAL_DLOG_EVERY_N_IMPL(_##severity, n) +#define DLOG_FIRST_N(severity, n) \ + ABSL_LOG_INTERNAL_DLOG_FIRST_N_IMPL(_##severity, n) +#define DLOG_EVERY_POW_2(severity) \ + ABSL_LOG_INTERNAL_DLOG_EVERY_POW_2_IMPL(_##severity) #define DLOG_EVERY_N_SEC(severity, n_seconds) \ - ABSL_DLOG_EVERY_N_SEC_IMPL(_##severity, n_seconds) + ABSL_LOG_INTERNAL_DLOG_EVERY_N_SEC_IMPL(_##severity, n_seconds) // `LOG_IF_EVERY_N` and friends behave as the corresponding `LOG_EVERY_N` // but neither increment a counter nor log a message if condition is false (as @@ -279,30 +291,30 @@ // LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << COUNTER // << "th big cookie"; #define LOG_IF_EVERY_N(severity, condition, n) \ - ABSL_LOG_IF_EVERY_N_IMPL(_##severity, condition, n) + ABSL_LOG_INTERNAL_LOG_IF_EVERY_N_IMPL(_##severity, condition, n) #define LOG_IF_FIRST_N(severity, condition, n) \ - ABSL_LOG_IF_FIRST_N_IMPL(_##severity, condition, n) + ABSL_LOG_INTERNAL_LOG_IF_FIRST_N_IMPL(_##severity, condition, n) #define LOG_IF_EVERY_POW_2(severity, condition) \ - ABSL_LOG_IF_EVERY_POW_2_IMPL(_##severity, condition) + ABSL_LOG_INTERNAL_LOG_IF_EVERY_POW_2_IMPL(_##severity, condition) #define LOG_IF_EVERY_N_SEC(severity, condition, n_seconds) \ - ABSL_LOG_IF_EVERY_N_SEC_IMPL(_##severity, condition, n_seconds) + ABSL_LOG_INTERNAL_LOG_IF_EVERY_N_SEC_IMPL(_##severity, condition, n_seconds) #define PLOG_IF_EVERY_N(severity, condition, n) \ - ABSL_PLOG_IF_EVERY_N_IMPL(_##severity, condition, n) + ABSL_LOG_INTERNAL_PLOG_IF_EVERY_N_IMPL(_##severity, condition, n) #define PLOG_IF_FIRST_N(severity, condition, n) \ - ABSL_PLOG_IF_FIRST_N_IMPL(_##severity, condition, n) + ABSL_LOG_INTERNAL_PLOG_IF_FIRST_N_IMPL(_##severity, condition, n) #define PLOG_IF_EVERY_POW_2(severity, condition) \ - ABSL_PLOG_IF_EVERY_POW_2_IMPL(_##severity, condition) + ABSL_LOG_INTERNAL_PLOG_IF_EVERY_POW_2_IMPL(_##severity, condition) #define PLOG_IF_EVERY_N_SEC(severity, condition, n_seconds) \ - ABSL_PLOG_IF_EVERY_N_SEC_IMPL(_##severity, condition, n_seconds) + ABSL_LOG_INTERNAL_PLOG_IF_EVERY_N_SEC_IMPL(_##severity, condition, n_seconds) #define DLOG_IF_EVERY_N(severity, condition, n) \ - ABSL_DLOG_IF_EVERY_N_IMPL(_##severity, condition, n) + ABSL_LOG_INTERNAL_DLOG_IF_EVERY_N_IMPL(_##severity, condition, n) #define DLOG_IF_FIRST_N(severity, condition, n) \ - ABSL_DLOG_IF_FIRST_N_IMPL(_##severity, condition, n) + ABSL_LOG_INTERNAL_DLOG_IF_FIRST_N_IMPL(_##severity, condition, n) #define DLOG_IF_EVERY_POW_2(severity, condition) \ - ABSL_DLOG_IF_EVERY_POW_2_IMPL(_##severity, condition) + ABSL_LOG_INTERNAL_DLOG_IF_EVERY_POW_2_IMPL(_##severity, condition) #define DLOG_IF_EVERY_N_SEC(severity, condition, n_seconds) \ - ABSL_DLOG_IF_EVERY_N_SEC_IMPL(_##severity, condition, n_seconds) + ABSL_LOG_INTERNAL_DLOG_IF_EVERY_N_SEC_IMPL(_##severity, condition, n_seconds) #endif // ABSL_LOG_LOG_H_ |