mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-09 12:23:32 -04:00
5 lines
No EOL
4.7 KiB
HTML
5 lines
No EOL
4.7 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Trace_fuchsia (trace-fuchsia.Trace_fuchsia)</title><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.2"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../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">trace-fuchsia</a> » Trace_fuchsia</nav><header class="odoc-preamble"><h1>Module <code><span>Trace_fuchsia</span></code></h1><p>Fuchsia trace collector.</p><p>This provides a collector for traces that emits data into a file using the compact binary <a href="https://fuchsia.dev/fuchsia-src/reference/tracing/trace-format">Fuchsia trace format</a>. This reduces the tracing overhead compared to <code>trace-tef</code>, at the expense of simplicity.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-collector"><a href="#val-collector" class="anchor"></a><code><span><span class="keyword">val</span> collector :
|
||
<span>out:<span>[ <span>`File of string</span> <span>| `Stderr</span> <span>| `Stdout</span> ]</span> <span class="arrow">-></span></span>
|
||
<span>unit <span class="arrow">-></span></span>
|
||
<a href="../../trace/Trace_core/index.html#type-collector">Trace_core.collector</a></span></code></div><div class="spec-doc"><p>Make a collector that writes into the given output. See <a href="#val-setup"><code>setup</code></a> for more details.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-output"><a href="#type-output" class="anchor"></a><code><span><span class="keyword">type</span> output</span><span> = </span><span>[ </span></code><ol><li id="type-output.Stdout" class="def constructor anchored"><a href="#type-output.Stdout" class="anchor"></a><code><span>| </span></code><code><span>`Stdout</span></code></li><li id="type-output.Stderr" class="def constructor anchored"><a href="#type-output.Stderr" class="anchor"></a><code><span>| </span></code><code><span>`Stderr</span></code></li><li id="type-output.File" class="def constructor anchored"><a href="#type-output.File" class="anchor"></a><code><span>| </span></code><code><span>`File <span class="keyword">of</span> string</span></code></li></ol><code><span> ]</span></code></div><div class="spec-doc"><p>Output for tracing.</p><ul><li><code>`Stdout</code> will enable tracing and print events on stdout</li><li><code>`Stderr</code> will enable tracing and print events on stderr</li><li><code>`File "foo"</code> will enable tracing and print events into file named "foo"</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-setup"><a href="#val-setup" class="anchor"></a><code><span><span class="keyword">val</span> setup : <span>?out:<span>[ <a href="#type-output">output</a> <span>| `Env</span> ]</span> <span class="arrow">-></span></span> <span>unit <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p><code>setup ()</code> installs the collector depending on <code>out</code>.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">out</span> <p>can take different values:</p><ul><li>regular <a href="#type-output"><code>output</code></a> value to specify where events go</li><li><code>`Env</code> will enable tracing if the environment variable "TRACE" is set.</li></ul><ul><li>If it's set to "1", then the file is "trace.fxt".</li><li>If it's set to "stdout", then logging happens on stdout (since 0.2)</li><li>If it's set to "stderr", then logging happens on stdout (since 0.2)</li><li>Otherwise, if it's set to a non empty string, the value is taken to be the file path into which to write.</li></ul></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_setup"><a href="#val-with_setup" class="anchor"></a><code><span><span class="keyword">val</span> with_setup : <span>?out:<span>[ <a href="#type-output">output</a> <span>| `Env</span> ]</span> <span class="arrow">-></span></span> <span>unit <span class="arrow">-></span></span> <span><span>(<span>unit <span class="arrow">-></span></span> <span class="type-var">'a</span>)</span> <span class="arrow">-></span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>with_setup () f</code> (optionally) sets a collector up, calls <code>f()</code>, and makes sure to shutdown before exiting.</p></div></div></div></body></html> |