<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>PrintBox_runtime (ppx_minidebug.Minidebug_runtime.PrintBox_runtime)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.3"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../odoc.support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> â€“ <a href="../../index.html">ppx_minidebug</a> &#x00BB; <a href="../index.html">Minidebug_runtime</a> &#x00BB; PrintBox_runtime</nav><header class="odoc-preamble"><h1>Module type <code><span>Minidebug_runtime.PrintBox_runtime</span></code></h1></header><div class="odoc-content"><div class="odoc-include"><details open="open"><summary class="spec include"><code><span><span class="keyword">include</span> <a href="../module-type-Debug_runtime/index.html">Debug_runtime</a></span></code></summary><div class="odoc-spec"><div class="spec value anchored" id="val-close_log"><a href="#val-close_log" class="anchor"></a><code><span><span class="keyword">val</span> close_log : <span><span class="label">fname</span>:string <span class="arrow">&#45;&gt;</span></span> <span><span class="label">start_lnum</span>:int <span class="arrow">&#45;&gt;</span></span> <span><span class="label">entry_id</span>:int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-open_log"><a href="#val-open_log" class="anchor"></a><code><span><span class="keyword">val</span> open_log : 
  <span><span class="label">fname</span>:string <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">start_lnum</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">start_colnum</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">end_lnum</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">end_colnum</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">message</span>:string <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">entry_id</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">log_level</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span>[ `Diagn <span>| `Debug</span> <span>| `Track</span> ]</span> <span class="arrow">&#45;&gt;</span></span>
  unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-open_log_no_source"><a href="#val-open_log_no_source" class="anchor"></a><code><span><span class="keyword">val</span> open_log_no_source : 
  <span><span class="label">message</span>:string <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">entry_id</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">log_level</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span>[ `Diagn <span>| `Debug</span> <span>| `Track</span> ]</span> <span class="arrow">&#45;&gt;</span></span>
  unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-log_value_sexp"><a href="#val-log_value_sexp" class="anchor"></a><code><span><span class="keyword">val</span> log_value_sexp : 
  <span><span class="optlabel">?descr</span>:string <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">entry_id</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">log_level</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">is_result</span>:bool <span class="arrow">&#45;&gt;</span></span>
  <span><span class="xref-unresolved">Sexplib0</span>.Sexp.t <span class="arrow">&#45;&gt;</span></span>
  unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-log_value_pp"><a href="#val-log_value_pp" class="anchor"></a><code><span><span class="keyword">val</span> log_value_pp : 
  <span><span class="optlabel">?descr</span>:string <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">entry_id</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">log_level</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">pp</span>:<span>(<span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">is_result</span>:bool <span class="arrow">&#45;&gt;</span></span>
  <span><span class="type-var">'a</span> <span class="arrow">&#45;&gt;</span></span>
  unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-log_value_show"><a href="#val-log_value_show" class="anchor"></a><code><span><span class="keyword">val</span> log_value_show : 
  <span><span class="optlabel">?descr</span>:string <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">entry_id</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">log_level</span>:int <span class="arrow">&#45;&gt;</span></span>
  <span><span class="label">is_result</span>:bool <span class="arrow">&#45;&gt;</span></span>
  <span>string <span class="arrow">&#45;&gt;</span></span>
  unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-log_value_printbox"><a href="#val-log_value_printbox" class="anchor"></a><code><span><span class="keyword">val</span> log_value_printbox : <span><span class="label">entry_id</span>:int <span class="arrow">&#45;&gt;</span></span> <span><span class="label">log_level</span>:int <span class="arrow">&#45;&gt;</span></span> <span><span class="xref-unresolved">PrintBox</span>.t <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-exceeds_max_nesting"><a href="#val-exceeds_max_nesting" class="anchor"></a><code><span><span class="keyword">val</span> exceeds_max_nesting : <span>unit <span class="arrow">&#45;&gt;</span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-exceeds_max_children"><a href="#val-exceeds_max_children" class="anchor"></a><code><span><span class="keyword">val</span> exceeds_max_children : <span>unit <span class="arrow">&#45;&gt;</span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_entry_id"><a href="#val-get_entry_id" class="anchor"></a><code><span><span class="keyword">val</span> get_entry_id : <span>unit <span class="arrow">&#45;&gt;</span></span> int</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-max_nesting_depth"><a href="#val-max_nesting_depth" class="anchor"></a><code><span><span class="keyword">val</span> max_nesting_depth : <span><span>int option</span> <span class="xref-unresolved">Stdlib</span>.ref</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-max_num_children"><a href="#val-max_num_children" class="anchor"></a><code><span><span class="keyword">val</span> max_num_children : <span><span>int option</span> <span class="xref-unresolved">Stdlib</span>.ref</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-global_prefix"><a href="#val-global_prefix" class="anchor"></a><code><span><span class="keyword">val</span> global_prefix : string</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-snapshot"><a href="#val-snapshot" class="anchor"></a><code><span><span class="keyword">val</span> snapshot : <span>unit <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>For <code>PrintBox</code> runtimes, 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. Does nothing for the <code>Flushing</code> runtimes.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-description"><a href="#val-description" class="anchor"></a><code><span><span class="keyword">val</span> description : string</span></code></div><div class="spec-doc"><p>A description that should be sufficient to locate where the logs end up. If not configured explicitly, it will be some combination of: the global prefix, the file name or &quot;stdout&quot;.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-no_debug_if"><a href="#val-no_debug_if" class="anchor"></a><code><span><span class="keyword">val</span> no_debug_if : <span>bool <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>For <code>PrintBox</code> runtimes, 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 (<code>no_debug_if false</code> does <em>not</em> re-enable the log). Does nothing for the <code>Flushing</code> runtimes.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-log_level"><a href="#val-log_level" class="anchor"></a><code><span><span class="keyword">val</span> log_level : <span>int <span class="xref-unresolved">Stdlib</span>.ref</span></span></code></div><div class="spec-doc"><p>The runtime log level.</p><p>The log levels are used both at compile time, and for the PrintBox runtime. Not logging at compile time means the corresponding logging code is not generated; not logging at runtime means the logging state is not updated.</p></div></div></details></div><div class="odoc-spec"><div class="spec type anchored" id="type-config"><a href="#type-config" class="anchor"></a><code><span><span class="keyword">type</span> config</span><span> = </span><span>{</span></code><ol><li id="type-config.hyperlink" class="def record field anchored"><a href="#type-config.hyperlink" class="anchor"></a><code><span><span class="keyword">mutable</span> hyperlink : <span>[ <span>`Prefix of string</span> <span>| `No_hyperlinks</span> ]</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>If <code>hyperlink</code> is <code>`Prefix prefix</code>, code pointers are rendered as hyperlinks. When <code>prefix</code> is either empty, starts with a dot, or starts with <code>&quot;http:&quot;</code> or <code>&quot;https:&quot;</code>, the link address has the form <code>sprintf &quot;%s#L%d&quot; fname start_lnum</code>, allowing browsing in HTML directly. Otherwise, it has the form <code>sprintf &quot;%s:%d:%d&quot; fname start_lnum (start_colnum + 1)</code>, intended for editor-specific prefixes such as <code>&quot;vscode://file/&quot;</code>.</p><p>Note that rendering a link on a node will make the node non-foldable, therefore it is best to combine <code>`Prefix prefix</code> with <code>values_first_mode=true</code>.</p><span class="comment-delim">*)</span></div></li><li id="type-config.toc_specific_hyperlink" class="def record field anchored"><a href="#type-config.toc_specific_hyperlink" class="anchor"></a><code><span><span class="keyword">mutable</span> toc_specific_hyperlink : <span>string option</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>If provided, overrides <code>hyperlink</code> as the prefix used for generating URIs pointing to anchors in logs.</p><span class="comment-delim">*)</span></div></li><li id="type-config.backend" class="def record field anchored"><a href="#type-config.backend" class="anchor"></a><code><span><span class="keyword">mutable</span> backend : <span>[ `Text
                  <span><span>| `Html</span> of <span class="xref-unresolved">PrintBox_html</span>.Config.t</span>
                  <span><span>| `Markdown</span> of <span class="xref-unresolved">PrintBox_md</span>.Config.t</span> ]</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>If the content is <code>`Text</code>, logs are generated as monospaced text; for other settings as html or markdown.</p><span class="comment-delim">*)</span></div></li><li id="type-config.boxify_sexp_from_size" class="def record field anchored"><a href="#type-config.boxify_sexp_from_size" class="anchor"></a><code><span><span class="keyword">mutable</span> boxify_sexp_from_size : int;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>If positive, <code>Sexp.t</code>-based logs with this many or more atoms are converted to print-boxes before logging. Disabled by default (i.e. negative).</p><span class="comment-delim">*)</span></div></li><li id="type-config.highlight_terms" class="def record field anchored"><a href="#type-config.highlight_terms" class="anchor"></a><code><span><span class="keyword">mutable</span> highlight_terms : <span><span class="xref-unresolved">Re</span>.re option</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Uses a highlight style for logs on paths ending with a log matching the regular expression.</p><span class="comment-delim">*)</span></div></li><li id="type-config.exclude_on_path" class="def record field anchored"><a href="#type-config.exclude_on_path" class="anchor"></a><code><span><span class="keyword">mutable</span> exclude_on_path : <span><span class="xref-unresolved">Re</span>.re option</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Does not propagate the highlight status from child logs through log headers matching the given regular expression.</p><span class="comment-delim">*)</span></div></li><li id="type-config.prune_upto" class="def record field anchored"><a href="#type-config.prune_upto" class="anchor"></a><code><span><span class="keyword">mutable</span> prune_upto : int;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>At depths lower than <code>prune_upto</code> (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 <code>0</code> -- no pruning.</p><span class="comment-delim">*)</span></div></li><li id="type-config.truncate_children" class="def record field anchored"><a href="#type-config.truncate_children" class="anchor"></a><code><span><span class="keyword">mutable</span> truncate_children : int;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>If &gt; 0, only the given number of the most recent children is kept at each node. Defaults to <code>0</code> -- keep all (no pruning).</p><span class="comment-delim">*)</span></div></li><li id="type-config.values_first_mode" class="def record field anchored"><a href="#type-config.values_first_mode" class="anchor"></a><code><span><span class="keyword">mutable</span> values_first_mode : bool;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>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.</p><span class="comment-delim">*)</span></div></li><li id="type-config.max_inline_sexp_size" class="def record field anchored"><a href="#type-config.max_inline_sexp_size" class="anchor"></a><code><span><span class="keyword">mutable</span> max_inline_sexp_size : int;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Maximal size (in atoms) up to which a sexp value can be inlined during &quot;boxification&quot;.</p><span class="comment-delim">*)</span></div></li><li id="type-config.max_inline_sexp_length" class="def record field anchored"><a href="#type-config.max_inline_sexp_length" class="anchor"></a><code><span><span class="keyword">mutable</span> max_inline_sexp_length : int;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Maximal length (in characters/bytes) up to which a sexp value can be inlined during &quot;boxification&quot;.</p><span class="comment-delim">*)</span></div></li><li id="type-config.snapshot_every_sec" class="def record field anchored"><a href="#type-config.snapshot_every_sec" class="anchor"></a><code><span><span class="keyword">mutable</span> snapshot_every_sec : <span>float option</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>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.</p><span class="comment-delim">*)</span></div></li><li id="type-config.sexp_unescape_strings" class="def record field anchored"><a href="#type-config.sexp_unescape_strings" class="anchor"></a><code><span><span class="keyword">mutable</span> sexp_unescape_strings : bool;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>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 <code>true</code>.</p><span class="comment-delim">*)</span></div></li><li id="type-config.with_toc_listing" class="def record field anchored"><a href="#type-config.with_toc_listing" class="anchor"></a><code><span><span class="keyword">mutable</span> with_toc_listing : bool;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>If true, outputs non-collapsed trees of ToC entries in the Table of Contents files.</p><span class="comment-delim">*)</span></div></li><li id="type-config.toc_flame_graph" class="def record field anchored"><a href="#type-config.toc_flame_graph" class="anchor"></a><code><span><span class="keyword">mutable</span> toc_flame_graph : bool;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>If true, outputs a minimalistic rendering of a flame graph in the Table of Contents files, with boxes positioned to reflect both the ToC entries hierarchy and elapsed times for the opening and closing of entries. Not supported in the <code>`Text</code> backend.</p><span class="comment-delim">*)</span></div></li><li id="type-config.flame_graph_separation" class="def record field anchored"><a href="#type-config.flame_graph_separation" class="anchor"></a><code><span><span class="keyword">mutable</span> flame_graph_separation : int;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>How many pixels a single box, for a log header, is expected to take in a flame graph. Defaults to <code>40</code>. Note: ideally the height of a flame tree should be calculated automatically, then this setting would disappear.</p><span class="comment-delim">*)</span></div></li></ol><code><span>}</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-config"><a href="#val-config" class="anchor"></a><code><span><span class="keyword">val</span> config : <a href="#type-config">config</a></span></code></div></div></div></body></html>
