raw_logging: Extract the inlined no-hook-registered behavior for LogPrefixHook to a default implementation.

PiperOrigin-RevId: 449306617
Change-Id: Ia3e87d2edcae7e9874998f21a0e2ff245e48fd96
diff --git a/absl/base/internal/raw_logging.cc b/absl/base/internal/raw_logging.cc
index ca2a75f..8c49f9a 100644
--- a/absl/base/internal/raw_logging.cc
+++ b/absl/base/internal/raw_logging.cc
@@ -79,12 +79,6 @@
 // Explicitly `#error` out when not `ABSL_LOW_LEVEL_WRITE_SUPPORTED`, except for
 // 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<LogFilterAndPrefixHook>
-    log_filter_and_prefix_hook;
-ABSL_INTERNAL_ATOMIC_HOOK_ATTRIBUTES
-absl::base_internal::AtomicHook<AbortHook> abort_hook;
-
 #ifdef ABSL_LOW_LEVEL_WRITE_SUPPORTED
 constexpr char kTruncated[] = " ... (message truncated)\n";
 
@@ -132,6 +126,18 @@
   return true;
 }
 
+bool DefaultLogFilterAndPrefix(absl::LogSeverity, const char* file, int line,
+                               char** buf, int* buf_size) {
+  DoRawLog(buf, buf_size, "[%s : %d] RAW: ", file, line);
+  return true;
+}
+
+ABSL_INTERNAL_ATOMIC_HOOK_ATTRIBUTES
+absl::base_internal::AtomicHook<LogFilterAndPrefixHook>
+    log_filter_and_prefix_hook(DefaultLogFilterAndPrefix);
+ABSL_INTERNAL_ATOMIC_HOOK_ATTRIBUTES
+absl::base_internal::AtomicHook<AbortHook> abort_hook;
+
 void RawLogVA(absl::LogSeverity severity, const char* file, int line,
               const char* format, va_list ap) ABSL_PRINTF_ATTRIBUTE(4, 0);
 void RawLogVA(absl::LogSeverity severity, const char* file, int line,
@@ -152,14 +158,7 @@
   }
 #endif
 
-  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);
-    }
-  }
+  enabled = log_filter_and_prefix_hook(severity, file, line, &buf, &size);
   const char* const prefix_end = buf;
 
 #ifdef ABSL_LOW_LEVEL_WRITE_SUPPORTED