package tezt

  1. Overview
  2. Docs

Modify the style of the log outputs

type timestamp =
  1. | Hidden
  2. | Visible of float -> string

Prefix the log message with a timestamp (Visible) or not (Hidden).

The function parameter of Visible receives a UNIX timestamp and shall format it as a string such as "HH:MM:SS.FFF". An example of such function is default_timestamp_format.

type prefix =
  1. | Hidden
  2. | Visible of string -> string

Prefix the log message with a prefix (Visible) or not (Hidden).

The function parameter of Visible receives the ~prefix argument of log functions and shall return how to print it, without brackets. Fun.id is typically used but you can also add colors, force character case, shorten prefixes which are too long etc.

val default_timestamp_format : float -> string

Format the timestamp as HH:MM:SS.FFF.

val default_timestamp : timestamp

Alias for Visible default_timestamp_format, or Hidden if --no-log-timestamp.

val default_prefix : prefix

Alias for Visible Fun.id, or Hidden if --no-log-prefix.

val set_timestamp : timestamp -> unit

set_timestamp timestamp sets the style for the timestamp.

val set_prefix : prefix -> unit

set_prefix prefix sets the style for the prefix.

val get_timestamp : unit -> timestamp

get_timestamp gets the style of the timestamp.

val get_prefix : unit -> prefix

get_prefix gets the style of the prefix.

OCaml

Innovation. Community. Security.