class LogBuffer

Defined at line 86 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

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

Writes a key/value pair to the buffer.

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

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 Encode (KeyValue<const char *, int8_t> value)

Encodes an int8

Defined at line 141 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 146 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 151 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 156 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 159 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 164 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 169 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 174 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 177 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 182 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 185 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 190 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 195 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 198 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 201 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 519 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 622 of file ../../sdk/lib/syslog/structured_backend/cpp/log_buffer.cc