class LogBuffer

Defined at line 87 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

Opaque structure representing the backend encode state.

This structure only has meaning to the backend and application code shouldn't

touch these values.

LogBuffers store the state of a log record that is in the process of being

encoded.

A LogBuffer is initialized by calling BeginRecord,

and is written to the LogSink by calling FlushRecord.

Calling BeginRecord on a LogBuffer will always initialize it to its

clean state.

Public Methods

void WriteKeyValue (std::string_view key, std::string_view value)

Defined at line 81 of file ../../sdk/lib/syslog/cpp/host/log_buffer.cc

void WriteKeyValue (std::string_view key, int64_t value)

Writes a key/value pair to the buffer.

Defined at line 85 of file ../../sdk/lib/syslog/cpp/host/log_buffer.cc

void WriteKeyValue (std::string_view key, uint64_t value)

Writes a key/value pair to the buffer.

Defined at line 89 of file ../../sdk/lib/syslog/cpp/host/log_buffer.cc

void WriteKeyValue (std::string_view key, double value)

Writes a key/value pair to the buffer.

Defined at line 93 of file ../../sdk/lib/syslog/cpp/host/log_buffer.cc

void WriteKeyValue (std::string_view key, bool value)

Writes a key/value pair to the buffer.

Defined at line 97 of file ../../sdk/lib/syslog/cpp/host/log_buffer.cc

uint64_t * data ()

Defined at line 119 of file ../../sdk/lib/syslog/cpp/host/log_buffer.h

uint64_t * record_state ()

Defined at line 121 of file ../../sdk/lib/syslog/cpp/host/log_buffer.h

size_t record_state_size ()

Defined at line 123 of file ../../sdk/lib/syslog/cpp/host/log_buffer.h

size_t data_size ()

Defined at line 125 of file ../../sdk/lib/syslog/cpp/host/log_buffer.h

void WriteKeyValue (std::string_view key, const char * value)

Writes a key/value pair to the buffer.

Defined at line 133 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, int8_t> value)

Encodes an int8

Defined at line 156 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, int16_t> value)

Encodes an int16

Defined at line 161 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, int32_t> value)

Encodes an int32

Defined at line 166 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, int64_t> value)

Encodes an int64

Defined at line 171 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, uint8_t> value)

Encodes an uint8_t

Defined at line 174 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, uint16_t> value)

Encodes an uint16_t

Defined at line 179 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, uint32_t> value)

Encodes a uint32_t

Defined at line 184 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, uint64_t> value)

Encodes an uint64

Defined at line 189 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, const char *> value)

Encodes a NULL-terminated C-string.

Defined at line 192 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, char *> value)

Encodes a NULL-terminated C-string.

Defined at line 197 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, std::string> value)

Encodes a C++ std::string.

Defined at line 200 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, std::string_view> value)

Encodes a C++ std::string_view.

Defined at line 205 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, double> value)

Encodes a double floating point value

Defined at line 210 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, float> value)

Encodes a floating point value

Defined at line 213 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void Encode (KeyValue<const char *, bool> value)

Encodes a boolean value

Defined at line 216 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.h

void BeginRecord (FuchsiaLogSeverity severity, std::optional<std::string_view> file_name, unsigned int line, std::optional<std::string_view> message, uint32_t dropped_count, zx_koid_t pid, zx_koid_t tid)

Initializes a LogBuffer

buffer -- The buffer to initialize

severity -- The severity of the log

file_name -- The name of the file that generated the log message

line -- The line number that caused this message to be generated

message -- The message to output.

the message should be interpreted as a C-style printf before being displayed to the

user.

dropped_count -- Number of dropped messages

pid -- The process ID that generated the message.

tid -- The thread ID that generated the message.

Defined at line 560 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.cc

void BeginRecord (zx::basic_time<((zx_clock_t)1)> time, FuchsiaLogSeverity severity, std::optional<std::string_view> file_name, unsigned int line, std::optional<std::string_view> message, uint32_t dropped_count, zx_koid_t pid, zx_koid_t tid)

Initializes a LogBuffer with a specified boot timestamp.

Defined at line 520 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.cc

cpp20::span<const uint8_t> EndRecord ()

Ends the record and returns a span for it. This is safe to be called multiple times.

If an encoding error has occurred an empty span will be returned.

Defined at line 636 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.cc