Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:40:53

0001 // Copyright 2022 The Abseil Authors.
0002 //
0003 // Licensed under the Apache License, Version 2.0 (the "License");
0004 // you may not use this file except in compliance with the License.
0005 // You may obtain a copy of the License at
0006 //
0007 //      https://www.apache.org/licenses/LICENSE-2.0
0008 //
0009 // Unless required by applicable law or agreed to in writing, software
0010 // distributed under the License is distributed on an "AS IS" BASIS,
0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012 // See the License for the specific language governing permissions and
0013 // limitations under the License.
0014 //
0015 // -----------------------------------------------------------------------------
0016 // File: log/internal/log_sink_set.h
0017 // -----------------------------------------------------------------------------
0018 
0019 #ifndef ABSL_LOG_INTERNAL_LOG_SINK_SET_H_
0020 #define ABSL_LOG_INTERNAL_LOG_SINK_SET_H_
0021 
0022 #include "absl/base/config.h"
0023 #include "absl/log/log_entry.h"
0024 #include "absl/log/log_sink.h"
0025 #include "absl/types/span.h"
0026 
0027 namespace absl {
0028 ABSL_NAMESPACE_BEGIN
0029 namespace log_internal {
0030 
0031 // Returns true if a globally-registered `LogSink`'s `Send()` is currently
0032 // being invoked on this thread.
0033 bool ThreadIsLoggingToLogSink();
0034 
0035 // This function may log to two sets of sinks:
0036 //
0037 // * If `extra_sinks_only` is true, it will dispatch only to `extra_sinks`.
0038 //   `LogMessage::ToSinkAlso` and `LogMessage::ToSinkOnly` are used to attach
0039 //    extra sinks to the entry.
0040 // * Otherwise it will also log to the global sinks set. This set is managed
0041 //   by `absl::AddLogSink` and `absl::RemoveLogSink`.
0042 void LogToSinks(const absl::LogEntry& entry,
0043                 absl::Span<absl::LogSink*> extra_sinks, bool extra_sinks_only);
0044 
0045 // Implementation for operations with log sink set.
0046 void AddLogSink(absl::LogSink* sink);
0047 void RemoveLogSink(absl::LogSink* sink);
0048 void FlushLogSinks();
0049 
0050 }  // namespace log_internal
0051 ABSL_NAMESPACE_END
0052 }  // namespace absl
0053 
0054 #endif  // ABSL_LOG_INTERNAL_LOG_SINK_SET_H_