package tracing

  1. Overview
  2. Docs

Starts by keeping events in internal memory buffers. After set_destination is called it will copy any buffered events into the new destination upon the next buffer switch, then provide a buffer directly from the newly set destination.

This is intended for use with a global trace writer which needs to be available from initialization time, before anything like a trace file has been set up.

It also provides one other feature not guaranteed by other destinations, which is that writes after close is called will be ignored without error. This behavior was chosen so that when adding performance instrumentation to functions, users don't have to worry about those functions potentially being called in late stages of application shutdown after a trace file has been closed.

type t
val create : unit -> t
val set_destination : t -> (module Writer_intf.Destination) -> unit
val to_destination : t -> (module Writer_intf.Destination)