tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

log_sink_set.h (1977B)


      1 // Copyright 2022 The Abseil Authors.
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //      https://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 //
     15 // -----------------------------------------------------------------------------
     16 // File: log/internal/log_sink_set.h
     17 // -----------------------------------------------------------------------------
     18 
     19 #ifndef ABSL_LOG_INTERNAL_LOG_SINK_SET_H_
     20 #define ABSL_LOG_INTERNAL_LOG_SINK_SET_H_
     21 
     22 #include "absl/base/config.h"
     23 #include "absl/log/log_entry.h"
     24 #include "absl/log/log_sink.h"
     25 #include "absl/types/span.h"
     26 
     27 namespace absl {
     28 ABSL_NAMESPACE_BEGIN
     29 namespace log_internal {
     30 
     31 // Returns true if a globally-registered `LogSink`'s `Send()` is currently
     32 // being invoked on this thread.
     33 bool ThreadIsLoggingToLogSink();
     34 
     35 // This function may log to two sets of sinks:
     36 //
     37 // * If `extra_sinks_only` is true, it will dispatch only to `extra_sinks`.
     38 //   `LogMessage::ToSinkAlso` and `LogMessage::ToSinkOnly` are used to attach
     39 //    extra sinks to the entry.
     40 // * Otherwise it will also log to the global sinks set. This set is managed
     41 //   by `absl::AddLogSink` and `absl::RemoveLogSink`.
     42 void LogToSinks(const absl::LogEntry& entry,
     43                absl::Span<absl::LogSink*> extra_sinks, bool extra_sinks_only);
     44 
     45 // Implementation for operations with log sink set.
     46 void AddLogSink(absl::LogSink* sink);
     47 void RemoveLogSink(absl::LogSink* sink);
     48 void FlushLogSinks();
     49 
     50 }  // namespace log_internal
     51 ABSL_NAMESPACE_END
     52 }  // namespace absl
     53 
     54 #endif  // ABSL_LOG_INTERNAL_LOG_SINK_SET_H_