Module Logs.Printers

Utility printers, that are aware of the current logging configuration.

val pp_unstable : name:string -> (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a -> unit

Wraps a pretty-printer for unstable values, that should not be output into e.g. testing environments where diffs matter. If the config option hide_unstable is set, will replace

val pp_time : Format.formatter -> float -> unit

Pretty-prints a time quantity in seconds, displaying it in either seconds or milli-seconds for smaller values (< 0.05s). Wrapped in pp_unstable.

val pp_percent : Format.formatter -> (float * float) -> unit

For a given value (total, part), prints what percentage of total is represented by part. e.g. pp_percent stdout (5.0, 1.0) will print 20.00%

val pp_percenti : Format.formatter -> (int * int) -> unit

Same as pp_percent, but for integer values (implicitly converts to float).

val pp_plural : sing:string -> plur:string -> Format.formatter -> int -> unit

Prints 1 sing if n = 1, n plur otherwise.

val pp_clr : Color.t -> Format.formatter -> string -> unit

Pretty-prints a string with a given color

val pp_style : Color.style -> Format.formatter -> string -> unit

Pretty-prints a string with a given style

val pp_clr2 : Color.t -> Color.style -> Format.formatter -> string -> unit

Pretty-prints a string with a given color and style

val pp_ok : Format.formatter -> string -> unit

Pretty-prints a string as an "ok"-colored message

val pp_err : Format.formatter -> string -> unit

Pretty-prints a string as an "error"-colored message

val pp_fatal : Format.formatter -> string -> unit

Pretty-prints a string as a "fatal"-colored message

val pp_warn : Format.formatter -> string -> unit

Pretty-prints a string as a "warning"-colored message