package ppx_minidebug

  1. Overview
  2. Docs

The logged traces will be pretty-printed as trees using the `printbox` package. This logger supports conditionally disabling a particular nesting of the logs, regardless of where in the nesting level no_debug_if is called.

Parameters

module _ : Shared_config

Signature

include Debug_runtime
val close_log : fname:string -> start_lnum:int -> entry_id:int -> unit
val open_log : fname:string -> start_lnum:int -> start_colnum:int -> end_lnum:int -> end_colnum:int -> message:string -> entry_id:int -> unit
val log_value_sexp : ?descr:string -> entry_id:int -> is_result:bool -> Sexplib0.Sexp.t -> unit
val log_value_pp : ?descr:string -> entry_id:int -> pp:(Format.formatter -> 'a -> unit) -> is_result:bool -> 'a -> unit
val log_value_show : ?descr:string -> entry_id:int -> is_result:bool -> string -> unit
val log_value_printbox : entry_id:int -> PrintBox.t -> unit
val exceeds_max_nesting : unit -> bool
val exceeds_max_children : unit -> bool
val get_entry_id : unit -> int
val max_nesting_depth : int option ref
val max_num_children : int option ref
val global_prefix : string
val no_debug_if : bool -> unit

When passed true within the scope of a log subtree, disables the logging of this subtree and its subtrees. Does not do anything when passed false (no_debug_if false does not re-enable the log).

type config = {
  1. mutable backend : [ `Text | `Html of PrintBox_html.Config.t | `Markdown of PrintBox_md.Config.t ];
    (*

    If the content is `Text, logs are generated as monospaced text; for other settings as html or markdown.

    *)
  2. mutable boxify_sexp_from_size : int;
    (*

    If positive, Sexp.t-based logs with this many or more atoms are converted to print-boxes before logging. Disabled by default (i.e. negative).

    *)
  3. mutable highlight_terms : Re.re option;
    (*

    Uses a highlight style for logs on paths ending with a log matching the regular expression.

    *)
  4. mutable exclude_on_path : Re.re option;
    (*

    Does not propagate the highlight status from child logs through log headers matching the given regular expression.

    *)
  5. mutable prune_upto : int;
    (*

    At depths lower than prune_upto (or equal if counting from 1) only ouptputs highlighted boxes. This makes it simpler to trim excessive logging while still providing some context. Defaults to 0 -- no pruning.

    *)
  6. mutable truncate_children : int;
    (*

    If > 0, only the given number of the most recent children is kept at each node. Defaults to 0 -- keep all (no pruning).

    *)
  7. mutable values_first_mode : bool;
    (*

    If set to true, does not put the source code location of a computation as a header of its subtree. Rather, puts the result of the computation as the header of a computation subtree, if rendered as a single line -- or just the name, and puts the result near the top. If false, puts the result at the end of the computation subtree, i.e. preserves the order of the computation.

    *)
  8. mutable max_inline_sexp_size : int;
    (*

    Maximal size (in atoms) up to which a sexp value can be inlined during "boxification".

    *)
  9. mutable max_inline_sexp_length : int;
    (*

    Maximal length (in characters/bytes) up to which a sexp value can be inlined during "boxification".

    *)
  10. mutable log_level : log_level;
    (*

    How much to log, see log_level.

    *)
  11. mutable snapshot_every_sec : float option;
    (*

    If given, output a snapshot of the pending logs when at least the given time (in seconds) has passed since the previous output. This is only checked at calls to log values.

    *)
  12. mutable sexp_unescape_strings : bool;
    (*

    If true, when a value is a sexp atom or is decomposed into a sexp atom by boxification, it is not printed as a sexp, but the string of the atom is printed directly. Defaults to true.

    *)
}
val config : config
val snapshot : unit -> unit

Outputs the current logging stack to the logging channel. If the logging channel supports that, an output following a snapshot will rewind the channel to the state prior to the snapshot.

OCaml

Innovation. Community. Security.