absl::LogEntry::stacktrace

Returns the optional stacktrace, e.g. for FATAL logs and failed CHECKs.

Synopsis

Declared in <absl/log/log_entry.h>

std::string_view
stacktrace() const;

Description

Fatal entries are dispatched to each sink twice: first with all data and metadata but no stacktrace, and then with the stacktrace. This is done because stacktrace collection is sometimes slow and fallible, and it's critical to log enough information to diagnose the failure even if the stacktrace collection hangs.

The buffer does not outlive the entry; if you need the data later, you must copy it.

Return Value

The stacktrace, or an empty string if none was collected.