diff options
author | Benjamin Barenblat <bbaren@google.com> | 2024-09-03 11:49:29 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2024-09-03 11:49:29 -0400 |
commit | c1afa8b8238c25591ca80d068477aa7d4ce05fc8 (patch) | |
tree | 284a9f8b319de5783ff83ad004a9e390cb60fd0d /absl/log/log_sink.h | |
parent | 23778b53f420f54eebc195dd8430e79bda165e5b (diff) | |
parent | 4447c7562e3bc702ade25105912dce503f0c4010 (diff) | |
download | abseil-c1afa8b8238c25591ca80d068477aa7d4ce05fc8.tar.gz abseil-c1afa8b8238c25591ca80d068477aa7d4ce05fc8.tar.bz2 abseil-c1afa8b8238c25591ca80d068477aa7d4ce05fc8.zip |
Merge new upstream LTS 20240722.0
Diffstat (limited to 'absl/log/log_sink.h')
-rw-r--r-- | absl/log/log_sink.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/absl/log/log_sink.h b/absl/log/log_sink.h index 9bfa6f86..2910070d 100644 --- a/absl/log/log_sink.h +++ b/absl/log/log_sink.h @@ -32,15 +32,16 @@ ABSL_NAMESPACE_BEGIN // `absl::LogSink` is an interface which can be extended to intercept and // process particular messages (with `LOG.ToSinkOnly()` or // `LOG.ToSinkAlso()`) or all messages (if registered with -// `absl::AddLogSink`). Implementations must be thread-safe, and should take -// care not to take any locks that might be held by the `LOG` caller. +// `absl::AddLogSink`). Implementations must not take any locks that might be +// held by the `LOG` caller. class LogSink { public: virtual ~LogSink() = default; // LogSink::Send() // - // `Send` is called synchronously during the log statement. + // `Send` is called synchronously during the log statement. `Send` must be + // thread-safe. // // It is safe to use `LOG` within an implementation of `Send`. `ToSinkOnly` // and `ToSinkAlso` are safe in general but can be used to create an infinite @@ -50,9 +51,15 @@ class LogSink { // LogSink::Flush() // // Sinks that buffer messages should override this method to flush the buffer - // and return. + // and return. `Flush` must be thread-safe. virtual void Flush() {} + protected: + LogSink() = default; + // Implementations may be copyable and/or movable. + LogSink(const LogSink&) = default; + LogSink& operator=(const LogSink&) = default; + private: // https://lld.llvm.org/missingkeyfunction.html#missing-key-function virtual void KeyFunction() const final; // NOLINT(readability/inheritance) |