|
||||
File indexing completed on 2024-11-15 09:01:06
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/log_sink_registry.h 0017 // ----------------------------------------------------------------------------- 0018 // 0019 // This header declares APIs to operate on global set of registered log sinks. 0020 0021 #ifndef ABSL_LOG_LOG_SINK_REGISTRY_H_ 0022 #define ABSL_LOG_LOG_SINK_REGISTRY_H_ 0023 0024 #include "absl/base/config.h" 0025 #include "absl/log/internal/log_sink_set.h" 0026 #include "absl/log/log_sink.h" 0027 0028 namespace absl { 0029 ABSL_NAMESPACE_BEGIN 0030 0031 // AddLogSink(), RemoveLogSink() 0032 // 0033 // Adds or removes a `absl::LogSink` as a consumer of logging data. 0034 // 0035 // These functions are thread-safe. 0036 // 0037 // It is an error to attempt to add a sink that's already registered or to 0038 // attempt to remove one that isn't. 0039 // 0040 // To avoid unbounded recursion, dispatch to registered `absl::LogSink`s is 0041 // disabled per-thread while running the `Send()` method of registered 0042 // `absl::LogSink`s. Affected messages are dispatched to a special internal 0043 // sink instead which writes them to `stderr`. 0044 // 0045 // Do not call these inside `absl::LogSink::Send`. 0046 inline void AddLogSink(absl::LogSink* sink) { log_internal::AddLogSink(sink); } 0047 inline void RemoveLogSink(absl::LogSink* sink) { 0048 log_internal::RemoveLogSink(sink); 0049 } 0050 0051 // FlushLogSinks() 0052 // 0053 // Calls `absl::LogSink::Flush` on all registered sinks. 0054 // 0055 // Do not call this inside `absl::LogSink::Send`. 0056 inline void FlushLogSinks() { log_internal::FlushLogSinks(); } 0057 0058 ABSL_NAMESPACE_END 0059 } // namespace absl 0060 0061 #endif // ABSL_LOG_LOG_SINK_REGISTRY_H_
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |