Skip to main content

File logging

Scope: ServerRpc (server-wide operations tied to the Client) For an overview of RPC and the list of all RPC pages, see RPC. logging()->file() writes logs through the runtime logger to a destination that the native host allows. You can’t specify a file path in the request. This API is experimental.

Open a logger and write to it

open() returns an opaque logId. The runtime redacts the values you register in secretValues from each message. Let your writes complete in order, then call flush() or close().
FileLogOperation accepts log, debug, info, notice, warning, error, startGroup, and endGroup. For endGroup, pass an empty string as message.

Flush and close

flush() waits until all earlier writes reach the file and reports any failure. close() also flushes, then closes the logger. After closing, you can’t use the same logId again.
Last modified on November 21, 2026