|
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Logging (infer.IBase.Logging)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.2"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">infer</a> » <a href="../index.html">IBase</a> » Logging</nav><h1>Module <code>IBase.Logging</code></h1></header><aside><p>log messages at different levels of verbosity</p></aside><div class="spec module" id="module-F"><a href="#module-F" class="anchor"></a><code><span class="keyword">module</span> F = Stdlib.Format</code></div><div><div class="spec include"><div class="doc"><details open="open"><summary><span class="def"><code><span class="keyword">include</span> <span class="keyword">module</span> <span class="keyword">type</span> <span class="keyword">of</span> <a href="../index.html#module-Die">Die</a></code></span></summary><dl><dt class="spec exception" id="exception-InferExternalError"><a href="#exception-InferExternalError" class="anchor"></a><code><span class="keyword">exception</span> </code><code><span class="exception">InferExternalError</span> <span class="keyword">of</span> string</code></dt><dt class="spec exception" id="exception-InferInternalError"><a href="#exception-InferInternalError" class="anchor"></a><code><span class="keyword">exception</span> </code><code><span class="exception">InferInternalError</span> <span class="keyword">of</span> string</code></dt><dt class="spec exception" id="exception-InferUserError"><a href="#exception-InferUserError" class="anchor"></a><code><span class="keyword">exception</span> </code><code><span class="exception">InferUserError</span> <span class="keyword">of</span> string</code></dt><dt class="spec exception" id="exception-InferExit"><a href="#exception-InferExit" class="anchor"></a><code><span class="keyword">exception</span> </code><code><span class="exception">InferExit</span> <span class="keyword">of</span> int</code></dt><dd><p>This can be used to avoid scattering exit invocations all over the codebase</p></dd></dl><dl><dt class="spec type" id="type-error"><a href="#type-error" class="anchor"></a><code><span class="keyword">type</span> error</code><code> = </code><table class="variant"><tr id="type-error.ExternalError" class="anchored"><td class="def constructor"><a href="#type-error.ExternalError" class="anchor"></a><code>| </code><code><span class="constructor">ExternalError</span></code></td></tr><tr id="type-error.InternalError" class="anchored"><td class="def constructor"><a href="#type-error.InternalError" class="anchor"></a><code>| </code><code><span class="constructor">InternalError</span></code></td></tr><tr id="type-error.UserError" class="anchored"><td class="def constructor"><a href="#type-error.UserError" class="anchor"></a><code>| </code><code><span class="constructor">UserError</span></code></td></tr></table></dt><dd><p>kind of error for <code>die</code>, with similar semantics as <code>Logging.{external,internal,user}_error</code></p></dd></dl><dl><dt class="spec value" id="val-exit"><a href="#val-exit" class="anchor"></a><code><span class="keyword">val</span> exit : int <span>-></span> <span class="type-var">'a</span></code></dt><dt class="spec value" id="val-exit_code_of_exception"><a href="#val-exit_code_of_exception" class="anchor"></a><code><span class="keyword">val</span> exit_code_of_exception : <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.Exn.t <span>-></span> int</code></dt><dt class="spec value" id="val-set_log_uncaught_exception_callback"><a href="#val-set_log_uncaught_exception_callback" class="anchor"></a><code><span class="keyword">val</span> set_log_uncaught_exception_callback : <span>(exn <span>-></span> <span>exitcode:int</span> <span>-></span> unit)</span> <span>-></span> unit</code></dt><dt class="spec value" id="val-log_uncaught_exception"><a href="#val-log_uncaught_exception" class="anchor"></a><code><span class="keyword">val</span> log_uncaught_exception : exn <span>-></span> <span>exitcode:int</span> <span>-></span> unit</code></dt><dt class="spec value" id="val-die"><a href="#val-die" class="anchor"></a><code><span class="keyword">val</span> die : <a href="index.html#type-error">error</a> <span>-></span> <span><span>(<span class="type-var">'a</span>, Stdlib.Format.formatter, unit, <span class="type-var">_</span>)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format4</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>Raise the corresponding exception.</p></dd></dl><dl><dt class="spec value" id="val-raise_error"><a href="#val-raise_error" class="anchor"></a><code><span class="keyword">val</span> raise_error : <span>?⁠backtrace:<a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.Caml.Printexc.raw_backtrace</span> <span>-></span> <a href="index.html#type-error">error</a> <span>-></span> <span>msg:string</span> <span>-></span> <span class="type-var">'a</span></code></dt></dl><dl><dt class="spec type" id="type-style"><a href="#type-style" class="anchor"></a><code><span class="keyword">type</span> style</code><code> = </code><table class="variant"><tr id="type-style.Error" class="anchored"><td class="def constructor"><a href="#type-style.Error" class="anchor"></a><code>| </code><code><span class="constructor">Error</span></code></td></tr><tr id="type-style.Fatal" class="anchored"><td class="def constructor"><a href="#type-style.Fatal" class="anchor"></a><code>| </code><code><span class="constructor">Fatal</span></code></td></tr><tr id="type-style.Normal" class="anchored"><td class="def constructor"><a href="#type-style.Normal" class="anchor"></a><code>| </code><code><span class="constructor">Normal</span></code></td></tr><tr id="type-style.Warning" class="anchored"><td class="def constructor"><a href="#type-style.Warning" class="anchor"></a><code>| </code><code><span class="constructor">Warning</span></code></td></tr></table></dt></dl><dl><dt class="spec value" id="val-term_styles_of_style"><a href="#val-term_styles_of_style" class="anchor"></a><code><span class="keyword">val</span> term_styles_of_style : <a href="index.html#type-style">style</a> <span>-></span> <span><a href="../../IStdlib/IStd/index.html#module-ANSITerminal">IStdlib.IStd.ANSITerminal</a>.style list</span></code></dt></dl></details></div></div></div><dl><dt class="spec value" id="val-environment_info"><a href="#val-environment_info" class="anchor"></a><code><span class="keyword">val</span> environment_info : <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>log information about the environment</p></dd></dl><dl><dt class="spec value" id="val-progress"><a href="#val-progress" class="anchor"></a><code><span class="keyword">val</span> progress : <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>print immediately to standard error unless --quiet is specified</p></dd></dl><dl><dt class="spec value" id="val-log_task"><a href="#val-log_task" class="anchor"></a><code><span class="keyword">val</span> log_task : <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>log progress in the log file and on the console unless there is an active task bar</p></dd></dl><dl><dt class="spec value" id="val-task_progress"><a href="#val-task_progress" class="anchor"></a><code><span class="keyword">val</span> task_progress : <span>f:<span>(unit <span>-></span> <span class="type-var">'a</span>)</span></span> <span>-></span> <span>(<a href="index.html#module-F">F</a>.formatter <span>-></span> <span class="type-var">'b</span> <span>-></span> unit)</span> <span>-></span> <span class="type-var">'b</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p><code>task_progress ~f pp x</code> executes <code>f</code> and log progress <code>pp x</code> in the log file and also on the console unless there is an active task bar</p></dd></dl><dl><dt class="spec value" id="val-result"><a href="#val-result" class="anchor"></a><code><span class="keyword">val</span> result : <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>Emit a result to stdout. Use only if the output format is stable and useful enough that it may conceivably get piped to another program, ie, almost never (use <code>progress</code> instead otherwise).</p></dd></dl><dl><dt class="spec value" id="val-user_error"><a href="#val-user_error" class="anchor"></a><code><span class="keyword">val</span> user_error : <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>bad input, etc. detected</p></dd></dl><dl><dt class="spec value" id="val-user_warning"><a href="#val-user_warning" class="anchor"></a><code><span class="keyword">val</span> user_warning : <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dt class="spec value" id="val-internal_error"><a href="#val-internal_error" class="anchor"></a><code><span class="keyword">val</span> internal_error : <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>huho, infer has a bug</p></dd></dl><dl><dt class="spec value" id="val-external_error"><a href="#val-external_error" class="anchor"></a><code><span class="keyword">val</span> external_error : <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>some other tool has a bug or is called wrongly</p></dd></dl><dl><dt class="spec value" id="val-external_warning"><a href="#val-external_warning" class="anchor"></a><code><span class="keyword">val</span> external_warning : <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt></dl><dl><dt class="spec type" id="type-debug_kind"><a href="#type-debug_kind" class="anchor"></a><code><span class="keyword">type</span> debug_kind</code><code> = </code><table class="variant"><tr id="type-debug_kind.Analysis" class="anchored"><td class="def constructor"><a href="#type-debug_kind.Analysis" class="anchor"></a><code>| </code><code><span class="constructor">Analysis</span></code></td></tr><tr id="type-debug_kind.BufferOverrun" class="anchored"><td class="def constructor"><a href="#type-debug_kind.BufferOverrun" class="anchor"></a><code>| </code><code><span class="constructor">BufferOverrun</span></code></td></tr><tr id="type-debug_kind.Capture" class="anchored"><td class="def constructor"><a href="#type-debug_kind.Capture" class="anchor"></a><code>| </code><code><span class="constructor">Capture</span></code></td></tr><tr id="type-debug_kind.Linters" class="anchored"><td class="def constructor"><a href="#type-debug_kind.Linters" class="anchor"></a><code>| </code><code><span class="constructor">Linters</span></code></td></tr><tr id="type-debug_kind.MergeCapture" class="anchored"><td class="def constructor"><a href="#type-debug_kind.MergeCapture" class="anchor"></a><code>| </code><code><span class="constructor">MergeCapture</span></code></td></tr><tr id="type-debug_kind.TestDeterminator" class="anchored"><td class="def constructor"><a href="#type-debug_kind.TestDeterminator" class="anchor"></a><code>| </code><code><span class="constructor">TestDeterminator</span></code></td></tr></table></dt><dt class="spec type" id="type-debug_level"><a href="#type-debug_level" class="anchor"></a><code><span class="keyword">type</span> debug_level</code><code> = </code><table class="variant"><tr id="type-debug_level.Quiet" class="anchored"><td class="def constructor"><a href="#type-debug_level.Quiet" class="anchor"></a><code>| </code><code><span class="constructor">Quiet</span></code></td><td class="doc"><p>innocuous, eg emitted once per toplevel execution</p></td></tr><tr id="type-debug_level.Medium" class="anchored"><td class="def constructor"><a href="#type-debug_level.Medium" class="anchor"></a><code>| </code><code><span class="constructor">Medium</span></code></td><td class="doc"><p>still fairly lightweight, eg emitted O(<number of infer processes>)</p></td></tr><tr id="type-debug_level.Verbose" class="anchored"><td class="def constructor"><a href="#type-debug_level.Verbose" class="anchor"></a><code>| </code><code><span class="constructor">Verbose</span></code></td><td class="doc"><p>go crazy</p></td></tr></table></dt><dd><p>Level of verbosity for debug output. Each level enables all the levels before it.</p></dd></dl><dl><dt class="spec value" id="val-debug"><a href="#val-debug" class="anchor"></a><code><span class="keyword">val</span> debug : <a href="index.html#type-debug_kind">debug_kind</a> <span>-></span> <a href="index.html#type-debug_level">debug_level</a> <span>-></span> <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>log debug info</p></dd></dl><dl><dt class="spec value" id="val-debug_dev"><a href="#val-debug_dev" class="anchor"></a><code><span class="keyword">val</span> debug_dev : <span><span>(<span class="type-var">'a</span>, Stdlib.Format.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>For debugging during development.</p></dd></dl><dl><dt class="spec type" id="type-ocaml_pos"><a href="#type-ocaml_pos" class="anchor"></a><code><span class="keyword">type</span> ocaml_pos</code><code> = string * int * int * int</code></dt><dd><p>Type of location in ml source: __POS__</p></dd></dl><dl><dt class="spec value" id="val-ocaml_pos_to_string"><a href="#val-ocaml_pos_to_string" class="anchor"></a><code><span class="keyword">val</span> ocaml_pos_to_string : <a href="index.html#type-ocaml_pos">ocaml_pos</a> <span>-></span> string</code></dt><dd><p>Convert an ocaml position to a string</p></dd></dl><dl><dt class="spec value" id="val-pp_ocaml_pos_opt"><a href="#val-pp_ocaml_pos_opt" class="anchor"></a><code><span class="keyword">val</span> pp_ocaml_pos_opt : <a href="index.html#module-F">F</a>.formatter <span>-></span> <span><a href="index.html#type-ocaml_pos">ocaml_pos</a> option</span> <span>-></span> unit</code></dt><dd><p>Pretty print a position in ocaml source</p></dd></dl><aside><p>log management</p></aside><dl><dt class="spec value" id="val-setup_log_file"><a href="#val-setup_log_file" class="anchor"></a><code><span class="keyword">val</span> setup_log_file : unit <span>-></span> unit</code></dt><dd><p>Set up logging to go to the log file. Call this once the results directory has been set up.</p></dd></dl><dl><dt class="spec value" id="val-reset_formatters"><a href="#val-reset_formatters" class="anchor"></a><code><span class="keyword">val</span> reset_formatters : unit <span>-></span> unit</code></dt><dd><p>Reset the formatters used for logging. Call this when you fork(2).</p></dd></dl><aside><p>Delayed printing (HTML debug, ...)</p></aside><dl><dt class="spec type" id="type-delayed_prints"><a href="#type-delayed_prints" class="anchor"></a><code><span class="keyword">type</span> delayed_prints</code></dt></dl><dl><dt class="spec value" id="val-d_pp"><a href="#val-d_pp" class="anchor"></a><code><span class="keyword">val</span> d_pp : <span>(<a href="index.html#module-F">F</a>.formatter <span>-></span> <span class="type-var">'a</span> <span>-></span> unit)</span> <span>-></span> <span class="type-var">'a</span> <span>-></span> unit</code></dt><dt class="spec value" id="val-d_pp_with_pe"><a href="#val-d_pp_with_pe" class="anchor"></a><code><span class="keyword">val</span> d_pp_with_pe : <span>?⁠color:<a href="../../IStdlib/Pp/index.html#type-color">IStdlib.Pp.color</a></span> <span>-></span> <span>(<a href="../../IStdlib/Pp/index.html#type-env">IStdlib.Pp.env</a> <span>-></span> <a href="index.html#module-F">F</a>.formatter <span>-></span> <span class="type-var">'a</span> <span>-></span> unit)</span> <span>-></span> <span class="type-var">'a</span> <span>-></span> unit</code></dt><dt class="spec value" id="val-force_and_reset_delayed_prints"><a href="#val-force_and_reset_delayed_prints" class="anchor"></a><code><span class="keyword">val</span> force_and_reset_delayed_prints : <a href="index.html#module-F">F</a>.formatter <span>-></span> unit</code></dt><dt class="spec value" id="val-get_and_reset_delayed_prints"><a href="#val-get_and_reset_delayed_prints" class="anchor"></a><code><span class="keyword">val</span> get_and_reset_delayed_prints : unit <span>-></span> <a href="index.html#type-delayed_prints">delayed_prints</a></code></dt><dd><p>return the delayed print actions and reset them</p></dd></dl><dl><dt class="spec value" id="val-set_delayed_prints"><a href="#val-set_delayed_prints" class="anchor"></a><code><span class="keyword">val</span> set_delayed_prints : <a href="index.html#type-delayed_prints">delayed_prints</a> <span>-></span> unit</code></dt><dd><p>set the delayed print actions</p></dd></dl><dl><dt class="spec value" id="val-reset_delayed_prints"><a href="#val-reset_delayed_prints" class="anchor"></a><code><span class="keyword">val</span> reset_delayed_prints : unit <span>-></span> unit</code></dt><dd><p>reset the delayed print actions</p></dd></dl><dl><dt class="spec value" id="val-d_str"><a href="#val-d_str" class="anchor"></a><code><span class="keyword">val</span> d_str : <span>?⁠color:<a href="../../IStdlib/Pp/index.html#type-color">IStdlib.Pp.color</a></span> <span>-></span> string <span>-></span> unit</code></dt><dd><p>dump a string</p></dd></dl><dl><dt class="spec value" id="val-d_strln"><a href="#val-d_strln" class="anchor"></a><code><span class="keyword">val</span> d_strln : <span>?⁠color:<a href="../../IStdlib/Pp/index.html#type-color">IStdlib.Pp.color</a></span> <span>-></span> string <span>-></span> unit</code></dt><dd><p>dump a string plus newline</p></dd></dl><dl><dt class="spec value" id="val-d_ln"><a href="#val-d_ln" class="anchor"></a><code><span class="keyword">val</span> d_ln : unit <span>-></span> unit</code></dt><dd><p>dump a newline</p></dd></dl><dl><dt class="spec value" id="val-d_printf"><a href="#val-d_printf" class="anchor"></a><code><span class="keyword">val</span> d_printf : <span>?⁠color:<a href="../../IStdlib/Pp/index.html#type-color">IStdlib.Pp.color</a></span> <span>-></span> <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dt class="spec value" id="val-d_printfln"><a href="#val-d_printfln" class="anchor"></a><code><span class="keyword">val</span> d_printfln : <span>?⁠color:<a href="../../IStdlib/Pp/index.html#type-color">IStdlib.Pp.color</a></span> <span>-></span> <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dt class="spec value" id="val-d_printfln_escaped"><a href="#val-d_printfln_escaped" class="anchor"></a><code><span class="keyword">val</span> d_printfln_escaped : <span>?⁠color:<a href="../../IStdlib/Pp/index.html#type-color">IStdlib.Pp.color</a></span> <span>-></span> <span><span>(<span class="type-var">'a</span>, <a href="index.html#module-F">F</a>.formatter, unit)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.format</span> <span>-></span> <span class="type-var">'a</span></code></dt><dt class="spec value" id="val-d_error"><a href="#val-d_error" class="anchor"></a><code><span class="keyword">val</span> d_error : string <span>-></span> unit</code></dt><dd><p>dump an error string</p></dd></dl><dl><dt class="spec value" id="val-d_warning"><a href="#val-d_warning" class="anchor"></a><code><span class="keyword">val</span> d_warning : string <span>-></span> unit</code></dt><dd><p>dump a warning string</p></dd></dl><dl><dt class="spec value" id="val-d_info"><a href="#val-d_info" class="anchor"></a><code><span class="keyword">val</span> d_info : string <span>-></span> unit</code></dt><dd><p>dump an info string</p></dd></dl><dl><dt class="spec value" id="val-d_indent"><a href="#val-d_indent" class="anchor"></a><code><span class="keyword">val</span> d_indent : int <span>-></span> unit</code></dt><dd><p>dump an indentation</p></dd></dl><dl><dt class="spec value" id="val-d_increase_indent"><a href="#val-d_increase_indent" class="anchor"></a><code><span class="keyword">val</span> d_increase_indent : unit <span>-></span> unit</code></dt><dd><p>dump command to increase the indentation level. NOTE: most likely, you need <code>d_with_indent</code> instead</p></dd></dl><dl><dt class="spec value" id="val-d_decrease_indent"><a href="#val-d_decrease_indent" class="anchor"></a><code><span class="keyword">val</span> d_decrease_indent : unit <span>-></span> unit</code></dt><dd><p>dump command to decrease the indentation level NOTE: most likely, you need <code>d_with_indent</code> instead.</p></dd></dl><dl><dt class="spec value" id="val-d_with_indent"><a href="#val-d_with_indent" class="anchor"></a><code><span class="keyword">val</span> d_with_indent : <span>?⁠pp_result:<span>(<a href="index.html#module-F">F</a>.formatter <span>-></span> <span class="type-var">'a</span> <span>-></span> unit)</span></span> <span>-></span> <span>name:string</span> <span>-></span> <span>(unit <span>-></span> <span class="type-var">'a</span>)</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p>Execute arbitrary function (the last argument) with a given <code>name</code> so that all logs written inside (if any) are written with indentation.</p><p><code>pp_result</code>, if provided, will make the result of a call to be printed as well (useful for cases when there are several places when the function returns).</p><p>NOTE: If you want to use it NOT at the very top level of a function, it is a code smell, and you probably want to split your function into smaller ones.</p></dd></dl></div></body></html> |