summaryrefslogtreecommitdiff
path: root/absl/base/internal/raw_logging.cc
diff options
context:
space:
mode:
authorGravatar Andy Getzendanner <durandal@google.com>2022-05-04 09:23:27 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-05-04 09:24:08 -0700
commit981e2c888094c26f54adce260e05fd29e07e5fc8 (patch)
tree05acc93af25610ff988b1e96f495cc44d135eeb5 /absl/base/internal/raw_logging.cc
parent8d9cef25c70321c794ff5559cc0b1e0fa5f85e72 (diff)
raw_logging: Rename LogPrefixHook to reflect the other half of it's job (filtering by severity).
PiperOrigin-RevId: 446476285 Change-Id: Ibd0913e06244424241200d17177a4f220fcb7861
Diffstat (limited to 'absl/base/internal/raw_logging.cc')
-rw-r--r--absl/base/internal/raw_logging.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/absl/base/internal/raw_logging.cc b/absl/base/internal/raw_logging.cc
index 509d7460..acf20f2a 100644
--- a/absl/base/internal/raw_logging.cc
+++ b/absl/base/internal/raw_logging.cc
@@ -14,11 +14,12 @@
#include "absl/base/internal/raw_logging.h"
-#include <stddef.h>
#include <cstdarg>
+#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <string>
#include "absl/base/attributes.h"
#include "absl/base/config.h"
@@ -78,11 +79,10 @@ namespace {
// a selected set of platforms for which we expect not to be able to raw log.
ABSL_INTERNAL_ATOMIC_HOOK_ATTRIBUTES
- absl::base_internal::AtomicHook<LogPrefixHook>
- log_prefix_hook;
+absl::base_internal::AtomicHook<LogFilterAndPrefixHook>
+ log_filter_and_prefix_hook;
ABSL_INTERNAL_ATOMIC_HOOK_ATTRIBUTES
- absl::base_internal::AtomicHook<AbortHook>
- abort_hook;
+absl::base_internal::AtomicHook<AbortHook> abort_hook;
#ifdef ABSL_LOW_LEVEL_WRITE_SUPPORTED
constexpr char kTruncated[] = " ... (message truncated)\n";
@@ -151,9 +151,9 @@ void RawLogVA(absl::LogSeverity severity, const char* file, int line,
}
#endif
- auto log_prefix_hook_ptr = log_prefix_hook.Load();
- if (log_prefix_hook_ptr) {
- enabled = log_prefix_hook_ptr(severity, file, line, &buf, &size);
+ auto log_filter_and_prefix_hook_ptr = log_filter_and_prefix_hook.Load();
+ if (log_filter_and_prefix_hook_ptr) {
+ enabled = log_filter_and_prefix_hook_ptr(severity, file, line, &buf, &size);
} else {
if (enabled) {
DoRawLog(&buf, &size, "[%s : %d] RAW: ", file, line);
@@ -230,7 +230,9 @@ ABSL_INTERNAL_ATOMIC_HOOK_ATTRIBUTES ABSL_DLL
absl::base_internal::AtomicHook<InternalLogFunction>
internal_log_function(DefaultInternalLog);
-void RegisterLogPrefixHook(LogPrefixHook func) { log_prefix_hook.Store(func); }
+void RegisterLogFilterAndPrefixHook(LogFilterAndPrefixHook func) {
+ log_filter_and_prefix_hook.Store(func);
+}
void RegisterAbortHook(AbortHook func) { abort_hook.Store(func); }