| // Copyright 2024 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.diagnostics; |
| |
| using zx; |
| |
| @available(added=HEAD) |
| const MONIKER_ARG_NAME string = "$__moniker"; |
| |
| @available(added=HEAD) |
| const COMPONENT_URL_ARG_NAME string = "$__url"; |
| |
| @available(added=HEAD) |
| const ROLLED_OUT_ARG_NAME string = "$__rolled_out"; |
| |
| @available(added=HEAD) |
| type LogStreamOptions = table { |
| /// What logs to stream through this socket. |
| 1: mode StreamMode; |
| |
| /// Whether or not to include the moniker in the record arguments. |
| /// Default: false |
| 2: include_moniker bool; |
| |
| /// Whether or not to include the component url in the record arguments. |
| /// Default: false |
| 3: include_component_url bool; |
| |
| /// Whether or not to include the number of rolled out logs in the record |
| /// arguments. |
| /// Default: false |
| 4: include_rolled_out bool; |
| }; |
| |
| @available(added=HEAD) |
| @discoverable(server="platform") |
| open protocol LogStream { |
| /// Enables clients to stream all logs stored in the Archivist. |
| /// Expects a Datagram socket handle that can be written to. |
| /// |
| /// Logs will be written in the original FXT format with two additional |
| /// arguments appended at the end of the record depending on the options |
| /// passed: |
| /// |
| /// - `$__moniker`: the moniker of the component that emitted the log. |
| /// - `$__url`: the URL of the component that emitted the log. |
| /// - `$__rolled_out`: the number of logs that were rolled out from the |
| /// buffer before this one. |
| flexible Connect(resource struct { |
| socket zx.Handle:<SOCKET, zx.Rights.WRITE | zx.Rights.WAIT>; |
| opts LogStreamOptions; |
| }); |
| }; |