Module Brr.Debug

Debugging tools.

Debug

val enter : unit -> unit

enter () stops and enters the JavaScript debugger (if available).

val pp_obj : Stdlib.Format.formatter -> < .. > Js_of_ocaml.Js.t -> unit

pp_obj ppf o applies the method toString to object o and prints the the resulting string on ppf.

val dump_obj : < .. > Js_of_ocaml.Js.t -> unit

dump_obj o dumps object o on the browser console with level debug.

Tracing

val tick : Stdlib.Format.formatter -> 'a -> unit

tick formats "tick" on any value.

val pr : ('a, Stdlib.Format.formatter, unit) Stdlib.Pervasives.format -> 'a

pr fmt ... unconditionally outputs on the browser console with level Debug. Use Log.debug for level-based conditional output.

val trace : ?⁠pp:(Stdlib.Format.formatter -> 'a -> unit) -> string -> 'a -> 'a

trace ~pp v traces with Log.debug the value of v with pp (defaults to tick) and identifier id. The function returns v.

val etrace : ?⁠obs:bool -> ?⁠pp:(Stdlib.Format.formatter -> 'a -> unit) -> string -> 'a Note.event -> 'a Note.event

etrace ~pp id e traces e's occurence with Log.debug, pp (defaults to tick) and identifier id. If obs is true, the return value is e itself and the tracing occurs through a logger, this will prevent e from being garbage collected. If obs is false, the return value is e mapped by a tracing identity.

val strace : ?⁠obs:bool -> ?⁠pp:(Stdlib.Format.formatter -> 'a -> unit) -> string -> 'a Note.signal -> 'a Note.signal

strace ~pp id s traces s's changes with Log.debug, pp and identifier id. If obs is true, the return value is s itself and the tracing occurs through a logger, this will prevent s from being gc'd. If obs is false, the return value is s mapped by a tracing identity and using s's equality function.