summaryrefslogtreecommitdiff
path: root/absl/log/log_entry.h
diff options
context:
space:
mode:
authorGravatar Andy Getzendanner <durandal@google.com>2022-11-17 12:17:17 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2022-11-17 12:18:03 -0800
commitebab79b5783b3298ee2f31251174c660c322d7ef (patch)
tree1b5309a16ca6e3c871b9df96d10a036f73cdc3eb /absl/log/log_entry.h
parent0c048353d2e7347f148228d785c3f0a8c81e2223 (diff)
Release structured logging.
This stores the operands to LOG (and CHECK) as separate fields in a serialized protobuf. The protobuf format is not yet published. PiperOrigin-RevId: 489275799 Change-Id: I86d83671a6b1feb2bddd5bee51552907897ca8eb
Diffstat (limited to 'absl/log/log_entry.h')
-rw-r--r--absl/log/log_entry.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/absl/log/log_entry.h b/absl/log/log_entry.h
index 30114c33..41de6e66 100644
--- a/absl/log/log_entry.h
+++ b/absl/log/log_entry.h
@@ -169,6 +169,15 @@ class LogEntry final {
return text_message_with_prefix_and_newline_and_nul_.data();
}
+ // Returns a serialized protobuf holding the operands streamed into this
+ // log message. The message definition is not yet published.
+ //
+ // The buffer does not outlive the entry; if you need the data later, you must
+ // copy them.
+ absl::string_view encoded_message() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
+ return encoding_;
+ }
+
// LogEntry::stacktrace()
//
// Optional stacktrace, e.g. for `FATAL` logs and failed `CHECK`s.
@@ -198,6 +207,7 @@ class LogEntry final {
tid_t tid_;
absl::Span<const char> text_message_with_prefix_and_newline_and_nul_;
size_t prefix_len_;
+ absl::string_view encoding_;
std::string stacktrace_;
friend class log_internal::LogEntryTestPeer;