Module Logger.Output

Log output.

We can have multiple log outputs, they each get a Log_event.t. See Reporter.to_outputs to see how to use these.

A log output must be thread-safe, as it will be called from multiple threads.

type t

A log output. It receives Log_event.ts and writes/sends them somewhere.

val stdout : unit -> t
val stderr : unit -> t
val to_event : emit_ev:(Log_event.t -> unit) -> flush:(unit -> unit) -> unit -> t
val filter_level : (level -> bool) -> t -> t
val to_str : emit_str:(string -> unit) -> flush:(unit -> unit) -> unit -> t
val to_chan : ?autoflush:bool -> out_channel -> t

Write into the channel, as text.

  • parameter autoflush

    if true (default) channel is flushed after each event

val to_chan_jsonl : ?autoflush:bool -> out_channel -> t

Write into the channel as jsonl.

  • parameter autoflush

    if true (default) channel is flushed after each event

Buffer pool for loggers. Please hold onto buffers for only a short period of time.