tree: 0283dea77db34499678ac0808c1b8f0658d5ec8a [path history] [tgz]
  1. cpp/
  3. fuchsia_syslog.h
  5. syslog_structured_backend.api

Fuchsia syslog structured backend

The Fuchsia syslog structured backend allows you to write structured logs to Archivist. Structured logging allows you to encode more information in your log than just text, allowing for richer analytics and diagnostics of your component. This library is meant for systems integrators, not application developers. tracks app development support.


Before using the API, you need to connect to Archivist using the LogSink protocol. After connecting, invoke ConnectStructured on the LogSink and pass in a socket. Use the other side of the socket to do any of the following:

Encoding a regular key-value-pair message

fuchsia_syslog::LogBuffer buffer;
buffer.BeginRecord(severity, file_name, line, msg, condition, logsink_socket, number_of_dropped_messages, pid, tid);
number_of_dropped_message+=buffer.FlushRecord() ? 0 : 1;

NOTE: Logs are best-effort (as are all diagnostics), a return value of true from FlushRecord means that the log was made available to the platform successfully, but it is not a guarantee that the message will make it to the readable log (for many reasons, including budget constraints, platform issues, or perhaps we're running on a build without logging at all).