Represents a single entry in a log, i.e., one LOG statement or failed CHECK.

Synopsis

Declared in <absl/log/log_entry.h>

class LogEntry final

Description

LogEntry is thread‐compatible.

Type Aliases

Name

Description

tid_t

Type used to represent a thread ID.

Member Functions

Name

Description

LogEntry [constructor] [deleted]

Deleted; pass LogEntry by reference instead, and do not store it as its state does not outlive the call to LogSink::Send().

operator= [deleted]

Deleted; instances are not copy‐assignable.

encoded_message

Returns a serialized protobuf holding the operands streamed into this log message. The message definition is not yet published.

log_severity

Returns this entry's severity. For LOG, taken from the first argument; for CHECK, always absl::LogSeverity::kFatal.

prefix

Returns true unless the metadata prefix was suppressed once by LOG(...).NoPrefix() or globally by absl::EnableLogPrefix(false). Implies text_message_with_prefix() == text_message().

source_basename

Returns the source file base name where the log message occurred.

source_filename

Returns the source file name where the log message occurred, taken from FILE unless overridden by LOG(...).AtLocation(...).

source_line

Returns the source line where the log message occurred, taken from LINE unless overridden by LOG(...).AtLocation(...).

stacktrace

Returns the optional stacktrace, e.g. for FATAL logs and failed `CHECK`s.

text_message

Returns the text‐formatted message without its metadata prefix and without a trailing newline.

text_message_with_newline

Returns the text‐formatted message without its metadata prefix, with a trailing newline.

text_message_with_prefix

Returns the text‐formatted message including its metadata prefix, but without a trailing newline.

text_message_with_prefix_and_newline

Returns the text‐formatted message including its metadata prefix and trailing newline.

text_message_with_prefix_and_newline_c_str

Returns a nul‐terminated C string of the text‐formatted message including its metadata prefix and trailing newline.

tid

Returns the ID of the thread that wrote this entry. Captured during evaluation of LOG, but can be overridden by LOG(...).WithThreadID(...).

timestamp

Returns the time at which this entry was written. Captured during evaluation of LOG, but can be overridden by LOG(...).WithTimestamp(...).

verbosity

Returns this entry's verbosity, or kNoVerbosityLevel for a non‐verbose entry. Taken from the argument to VLOG or from LOG(...).WithVerbosity(...).

Static Data Members

Name

Description

kNoVerboseLevel

Deprecated alias for kNoVerbosityLevel, to be removed.

kNoVerbosityLevel

For non‐verbose log entries, verbosity() returns kNoVerbosityLevel.

Friends

Name

Description

absl::PrintTo

Writes a human‐readable representation of entry to os, e.g. for use by test frameworks such as GoogleTest.

absl::log_internal::LogMessage

Created with MrDocs