package eio

  1. Overview
  2. Docs
val traceln : ?__POS__:(string * int * int * int) -> ('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> 'a

Writes trace logging using the current fiber's configured traceln function.

val with_trace_prefix : (Stdlib.Format.formatter -> unit) -> (unit -> 'a) -> 'a

with_trace_prefix fmt fn runs fn () with a traceln that outputs fmt before each message.

val traceln_mutex : Stdlib.Mutex.t

The mutex used to prevent two domains writing to stderr at once.

This might be useful if you want to write to it directly yourself, e.g. for a log reporter.

val default_traceln : ?__POS__:(string * int * int * int) -> ('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> 'a

default_traceln is a suitable default implementation for Eio.Std.traceln.

It writes output to stderr, prefixing each line with a "+". If __POS__ is given, it also displays the file and line number from that. It uses traceln_mutex so that only one domain's output is written at a time.

type traceln = {
  1. traceln : 'a. ?__POS__:(string * int * int * int) -> ('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> 'a;
}
type t = < traceln : traceln Fiber.key >
val v : t

Backends should use this for Eio.Stdenv.debug.

OCaml

Innovation. Community. Security.