Sophie

Sophie

distrib > Mageia > 3 > i586 > by-pkgid > 201a9f979540fcfb8136ebdbfe063650 > files > 25

ocaml-lwt-doc-2.4.2-5.mga3.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Lwt_io.html">
<link rel="next" href="Lwt_main.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class attributes" rel=Appendix href="index_attributes.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of class types" rel=Appendix href="index_class_types.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Lwt_condition" rel="Chapter" href="Lwt_condition.html">
<link title="Lwt_list" rel="Chapter" href="Lwt_list.html">
<link title="Lwt" rel="Chapter" href="Lwt.html">
<link title="Lwt_mutex" rel="Chapter" href="Lwt_mutex.html">
<link title="Lwt_mvar" rel="Chapter" href="Lwt_mvar.html">
<link title="Lwt_pool" rel="Chapter" href="Lwt_pool.html">
<link title="Lwt_sequence" rel="Chapter" href="Lwt_sequence.html">
<link title="Lwt_stream" rel="Chapter" href="Lwt_stream.html">
<link title="Lwt_switch" rel="Chapter" href="Lwt_switch.html">
<link title="Lwt_util" rel="Chapter" href="Lwt_util.html">
<link title="Lwt_pqueue" rel="Chapter" href="Lwt_pqueue.html">
<link title="Lwt_lib" rel="Chapter" href="Lwt_lib.html">
<link title="Lwt_glib" rel="Chapter" href="Lwt_glib.html">
<link title="Lwt_preemptive" rel="Chapter" href="Lwt_preemptive.html">
<link title="Lwt_event" rel="Chapter" href="Lwt_event.html">
<link title="Lwt_signal" rel="Chapter" href="Lwt_signal.html">
<link title="Lwt_react" rel="Chapter" href="Lwt_react.html">
<link title="Lwt_ssl" rel="Chapter" href="Lwt_ssl.html">
<link title="Lwt_text" rel="Chapter" href="Lwt_text.html">
<link title="Lwt_term" rel="Chapter" href="Lwt_term.html">
<link title="Lwt_read_line" rel="Chapter" href="Lwt_read_line.html">
<link title="Lwt_top" rel="Chapter" href="Lwt_top.html">
<link title="Lwt_chan" rel="Chapter" href="Lwt_chan.html">
<link title="Lwt_daemon" rel="Chapter" href="Lwt_daemon.html">
<link title="Lwt_gc" rel="Chapter" href="Lwt_gc.html">
<link title="Lwt_io" rel="Chapter" href="Lwt_io.html">
<link title="Lwt_log" rel="Chapter" href="Lwt_log.html">
<link title="Lwt_main" rel="Chapter" href="Lwt_main.html">
<link title="Lwt_process" rel="Chapter" href="Lwt_process.html">
<link title="Lwt_throttle" rel="Chapter" href="Lwt_throttle.html">
<link title="Lwt_timeout" rel="Chapter" href="Lwt_timeout.html">
<link title="Lwt_unix" rel="Chapter" href="Lwt_unix.html">
<link title="Lwt_sys" rel="Chapter" href="Lwt_sys.html">
<link title="Lwt_engine" rel="Chapter" href="Lwt_engine.html">
<link title="Lwt_bytes" rel="Chapter" href="Lwt_bytes.html">
<link title="Pa_lwt" rel="Chapter" href="Pa_lwt.html">
<link title="Pa_lwt_log" rel="Chapter" href="Pa_lwt_log.html"><link title="Types" rel="Section" href="#6_Types">
<link title="Logging functions" rel="Section" href="#6_Loggingfunctions">
<link title="Log templates" rel="Section" href="#6_Logtemplates">
<link title="Loggers" rel="Section" href="#6_Loggers">
<link title="Predefined loggers" rel="Section" href="#6_Predefinedloggers">
<title>Lwt_log</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Lwt_io.html" title="Lwt_io">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Lwt_main.html" title="Lwt_main">Next</a>
</div>
<h1>Module <a href="type_Lwt_log.html">Lwt_log</a></h1>
<pre><span class="keyword">module</span> Lwt_log: <code class="code"><span class="keyword">sig</span></code> <a href="Lwt_log.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Logging facility<br>
</div>
<hr width="100%">
<br>
This module provides functions to deal with logging.
    It support:
<p>
<ul>
<li>logging to the syslog daemon</li>
<li>logging to a channel (stderr, stdout, ...)</li>
<li>logging to a file</li>
<li>logging to multiple destination at the same time</li>
</ul>
<br>
<br>
<h6 id="6_Types">Types</h6><br>
<pre><code><span id="TYPElevel"><span class="keyword">type</span> <code class="type"></code>level</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTlevel.Debug"><span class="constructor">Debug</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Debugging message. They can be automatically removed by the
          syntax extension.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTlevel.Info"><span class="constructor">Info</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Informational message. Suitable to be displayed when the
          program is in verbose mode.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTlevel.Notice"><span class="constructor">Notice</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Same as <code class="code"><span class="constructor">Info</span></code>, but is displayed by default.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTlevel.Warning"><span class="constructor">Warning</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >Something strange happend</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTlevel.Error"><span class="constructor">Error</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >An error message, which should not means the end of the
          program.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTlevel.Fatal"><span class="constructor">Fatal</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >A fatal error happened, in most cases the program will end
          after a fatal error.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info">
Type of log levels. A level determines the importance of a
    message<br>
</div>

<pre><span id="TYPElogger"><span class="keyword">type</span> <code class="type"></code>logger</span> </pre>
<div class="info">
Type of a logger. A logger is responsible for dispatching messages
      and storing them somewhere.
<p>

      Lwt provides loggers sending log messages to a file, syslog,
      ... but you can also create you own logger.<br>
</div>

<pre><span id="TYPEsection"><span class="keyword">type</span> <code class="type"></code>section</span> </pre>
<div class="info">
Each logging message has a section. Sections can be used to
      structure your logs. For example you can choose different
      loggers according to the section.
<p>

      Each section carries a level, and messages with a lower log
      level than than the section level will be dropped.
<p>

      Section levels are initialised using the <code class="code"><span class="constructor">LWT_LOG</span></code> environment
      variable, which must contains one or more rules of the form
      <code class="code">pattern <span class="keywordsign">-&gt;</span> level</code> separated by ";". Where <code class="code">pattern</code> is a string
      that may contain <code class="code">*</code>.
<p>

      For example, if <code class="code"><span class="constructor">LWT_LOG</span></code> contains:
      <pre class="codepre"><code class="code">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;access&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;warning;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo[*]&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;error<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></pre>
      then the level of the section <code class="code"><span class="string">"access"</span></code> is <code class="code"><span class="constructor">Warning</span></code> and the
      level of any section matching <code class="code"><span class="string">"foo[*]"</span></code> is <code class="code"><span class="constructor">Error</span></code>.
<p>

      If the pattern is omited in a rule then the pattern <code class="code"><span class="string">"*"</span></code> is
      used instead, so <code class="code"><span class="constructor">LWT_LOG</span></code> may just contains <code class="code"><span class="string">"debug"</span></code> for
      instance.
<p>

      If <code class="code"><span class="constructor">LWT_LOG</span></code> is not defined then the rule <code class="code"><span class="string">"* -&gt; notice"</span></code> is
      used instead.<br>
</div>

<pre><span id="VALadd_rule"><span class="keyword">val</span> add_rule</span> : <code class="type">string -> <a href="Lwt_log.html#TYPElevel">level</a> -> unit</code></pre><div class="info">
<code class="code">add_rule pattern level</code> adds a rule for sections logging
      levels. The rule is added before all other rules. It takes
      effect immediatly and affect all sections for which the level
      has not been set explicitly with <a href="Lwt_log.Section.html#VALset_level"><code class="code"><span class="constructor">Lwt_log</span>.<span class="constructor">Section</span>.set_level</code></a>. <code class="code">pattern</code>
      may contains <code class="code">*</code>. For example:
<p>

      <pre class="codepre"><code class="code">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="constructor">Lwt_log</span>.add_rule&nbsp;<span class="string">"lwt*"</span>&nbsp;<span class="constructor">Lwt_log</span>.<span class="constructor">Info</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></pre><br>
</div>
<pre><span id="VALappend_rule"><span class="keyword">val</span> append_rule</span> : <code class="type">string -> <a href="Lwt_log.html#TYPElevel">level</a> -> unit</code></pre><div class="info">
<code class="code">append_rule pattern level</code> adds the given rule after all other
      rules. For example to set the default fallback rule:
<p>

      <pre class="codepre"><code class="code">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="constructor">Lwt_log</span>.append_rule&nbsp;<span class="string">"*"</span>&nbsp;<span class="constructor">Lwt_log</span>.<span class="constructor">Info</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></pre><br>
</div>
<br>
<h6 id="6_Loggingfunctions">Logging functions</h6><br>
<pre><span id="VALlog"><span class="keyword">val</span> log</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> level:<a href="Lwt_log.html#TYPElevel">level</a> -> string -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info">
<code class="code">log ?section ?logger ~level message</code> logs a message.
<p>

      <code class="code">section</code> defaults to <a href="Lwt_log.Section.html#VALmain"><code class="code"><span class="constructor">Lwt_log</span>.<span class="constructor">Section</span>.main</code></a>. If <code class="code">logger</code> is not
      specified, then the default one is used instead (see
      <a href="Lwt_log.html#VALdefault"><code class="code"><span class="constructor">Lwt_log</span>.default</code></a>).
<p>

      If <code class="code">exn</code> is provided, then its string representation
      (= <code class="code"><span class="constructor">Printexc</span>.to_string exn</code>) will be append to the message, and if
      possible the backtrace will also be logged.
<p>

      <code class="code">location</code> contains the location of the logging directive, it is
      of the form <code class="code">(file_name, line, column)</code>.<br>
</div>
<pre><span id="VALlog_f"><span class="keyword">val</span> log_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -><br>       level:<a href="Lwt_log.html#TYPElevel">level</a> -><br>       ('a, unit, string, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><div class="info">
<code class="code">log_f</code> is the same as <code class="code">log</code> except that it takes a format
      string<br>
</div>
<pre><span id="VALign_log"><span class="keyword">val</span> ign_log</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> level:<a href="Lwt_log.html#TYPElevel">level</a> -> string -> unit</code></pre><div class="info">
Same as <a href="Lwt_log.html#VALlog"><code class="code"><span class="constructor">Lwt_log</span>.log</code></a> but ignore the resulting thread.<br>
</div>
<pre><span id="VALign_log_f"><span class="keyword">val</span> ign_log_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -><br>       level:<a href="Lwt_log.html#TYPElevel">level</a> -> ('a, unit, string, unit) Pervasives.format4 -> 'a</code></pre><div class="info">
Same as <a href="Lwt_log.html#VALlog_f"><code class="code"><span class="constructor">Lwt_log</span>.log_f</code></a> but ignore the resulting thread.<br>
</div>
<br>
The following functions are the same as <a href="Lwt_log.html#VALlog"><code class="code"><span class="constructor">Lwt_log</span>.log</code></a> except that their
    name determines which level is used.
<p>

    For example <code class="code">info msg</code> is the same as <code class="code">log ~level:<span class="constructor">Info</span> msg</code>.<br>
<pre><span id="VALdebug"><span class="keyword">val</span> debug</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALdebug_f"><span class="keyword">val</span> debug_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -><br>       ('a, unit, string, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALign_debug"><span class="keyword">val</span> ign_debug</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -> ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit</code></pre><pre><span id="VALign_debug_f"><span class="keyword">val</span> ign_debug_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> ('a, unit, string, unit) Pervasives.format4 -> 'a</code></pre><pre><span id="VALinfo"><span class="keyword">val</span> info</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALinfo_f"><span class="keyword">val</span> info_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -><br>       ('a, unit, string, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALign_info"><span class="keyword">val</span> ign_info</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -> ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit</code></pre><pre><span id="VALign_info_f"><span class="keyword">val</span> ign_info_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> ('a, unit, string, unit) Pervasives.format4 -> 'a</code></pre><pre><span id="VALnotice"><span class="keyword">val</span> notice</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALnotice_f"><span class="keyword">val</span> notice_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -><br>       ('a, unit, string, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALign_notice"><span class="keyword">val</span> ign_notice</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -> ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit</code></pre><pre><span id="VALign_notice_f"><span class="keyword">val</span> ign_notice_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> ('a, unit, string, unit) Pervasives.format4 -> 'a</code></pre><pre><span id="VALwarning"><span class="keyword">val</span> warning</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALwarning_f"><span class="keyword">val</span> warning_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -><br>       ('a, unit, string, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALign_warning"><span class="keyword">val</span> ign_warning</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -> ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit</code></pre><pre><span id="VALign_warning_f"><span class="keyword">val</span> ign_warning_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> ('a, unit, string, unit) Pervasives.format4 -> 'a</code></pre><pre><span id="VALerror"><span class="keyword">val</span> error</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALerror_f"><span class="keyword">val</span> error_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -><br>       ('a, unit, string, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALign_error"><span class="keyword">val</span> ign_error</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -> ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit</code></pre><pre><span id="VALign_error_f"><span class="keyword">val</span> ign_error_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> ('a, unit, string, unit) Pervasives.format4 -> 'a</code></pre><pre><span id="VALfatal"><span class="keyword">val</span> fatal</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><pre><span id="VALfatal_f"><span class="keyword">val</span> fatal_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -><br>       ('a, unit, string, unit <a href="Lwt.html#TYPEt">Lwt.t</a>) Pervasives.format4 -> 'a</code></pre><pre><span id="VALign_fatal"><span class="keyword">val</span> ign_fatal</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -> ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> string -> unit</code></pre><pre><span id="VALign_fatal_f"><span class="keyword">val</span> ign_fatal_f</span> : <code class="type">?exn:exn -><br>       ?section:<a href="Lwt_log.html#TYPEsection">section</a> -><br>       ?location:string * int * int -><br>       ?logger:<a href="Lwt_log.html#TYPElogger">logger</a> -> ('a, unit, string, unit) Pervasives.format4 -> 'a</code></pre><pre><span class="keyword">module</span> <a href="Lwt_log.Section.html">Section</a>: <code class="code"><span class="keyword">sig</span></code> <a href="Lwt_log.Section.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Sections
</div>
<br>
<h6 id="6_Logtemplates">Log templates</h6><br>
<pre><span id="TYPEtemplate"><span class="keyword">type</span> <code class="type"></code>template</span> = <code class="type">string</code> </pre>
<div class="info">
A template is for generating log messages.
<p>

        It is a string which may contains variables of the form
        <code class="code">$(var)</code>, where <code class="code">var</code> is one of:
<p>
<ul>
<li><code class="code">date</code> which will be replaced with the current date</li>
<li><code class="code">milliseconds</code> which will be replaced by the fractionnal part
          of the current unix time</li>
<li><code class="code">name</code> which will be replaced by the program name</li>
<li><code class="code">pid</code> which will be replaced by the pid of the program</li>
<li><code class="code">message</code> which will be replaced by the message emited</li>
<li><code class="code">level</code> which will be replaced by a string representation of
          the level</li>
<li><code class="code">section</code> which will be replaced by the name of the
          message's section</li>
<li><code class="code">loc-file</code> which will be replaced by the file name of the
          calling logging function</li>
<li><code class="code">loc-line</code> which will be replaced by the line number of the
          calling logging function</li>
<li><code class="code">loc-column</code> which will be replaced by the column number of
           the calling logging function</li>
</ul>

        For example:<ul>
<li><code class="code"><span class="string">"$(name): $(message)"</span></code></li>
<li><code class="code"><span class="string">"$(date) $(name)[$(pid)]: $(message)"</span></code></li>
<li><code class="code"><span class="string">"$(date).$(milliseconds) $(name)[$(pid)]: $(message)"</span></code></li>
<li><code class="code"><span class="string">"$(date): $(loc-file): $(loc-line): $(loc-column): $(message)"</span></code></li>
</ul>
<br>
</div>

<pre><span id="VALrender"><span class="keyword">val</span> render</span> : <code class="type">buffer:Buffer.t -><br>       template:<a href="Lwt_log.html#TYPEtemplate">template</a> -><br>       section:<a href="Lwt_log.html#TYPEsection">section</a> -> level:<a href="Lwt_log.html#TYPElevel">level</a> -> message:string -> unit</code></pre><div class="info">
<code class="code">render ~buffer ~template ~section ~level ~message</code> instantiate
      all variables of <code class="code">template</code>, and store the result in
      <code class="code">buffer</code>. The location is obtained from threads local
      storage.<br>
</div>
<pre><span id="VALlocation_key"><span class="keyword">val</span> location_key</span> : <code class="type">(string * int * int) <a href="Lwt.html#TYPEkey">Lwt.key</a></code></pre><div class="info">
The key for storing current location.<br>
</div>
<br>
<h6 id="6_Loggers">Loggers</h6><br>
<pre><span id="EXCEPTIONLogger_closed"><span class="keyword">exception</span> Logger_closed</span></pre>
<div class="info">
Exception raised when trying to use a closed logger<br>
</div>
<pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type">output:(<a href="Lwt_log.html#TYPEsection">section</a> -> <a href="Lwt_log.html#TYPElevel">level</a> -> string list -> unit <a href="Lwt.html#TYPEt">Lwt.t</a>) -><br>       close:(unit -> unit <a href="Lwt.html#TYPEt">Lwt.t</a>) -> <a href="Lwt_log.html#TYPElogger">logger</a></code></pre><div class="info">
<code class="code">make ~output ~close</code> creates a new logger.<br>
</div>
<div class="param_info"><code class="code">output</code> : is used to write logs. It is a function which
      receive a section, a level and a list lines that must be logged
      together.</div>
<div class="param_info"><code class="code">close</code> : is used to close the logger.</div>
<pre><span id="VALclose"><span class="keyword">val</span> close</span> : <code class="type"><a href="Lwt_log.html#TYPElogger">logger</a> -> unit <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info">
Close the given logger<br>
</div>
<pre><span id="VALdefault"><span class="keyword">val</span> default</span> : <code class="type"><a href="Lwt_log.html#TYPElogger">logger</a> Pervasives.ref</code></pre><div class="info">
The default logger. It is used as default when no one is
      specified. Initially, it sends messages to the standard output
      for error messages.<br>
</div>
<pre><span id="VALbroadcast"><span class="keyword">val</span> broadcast</span> : <code class="type"><a href="Lwt_log.html#TYPElogger">logger</a> list -> <a href="Lwt_log.html#TYPElogger">logger</a></code></pre><div class="info">
<code class="code">broadcast loggers</code> is a logger which send messages to all the
      given loggers.
<p>

      Note: closing a broadcast logger does not close its
      components.<br>
</div>
<pre><span id="VALdispatch"><span class="keyword">val</span> dispatch</span> : <code class="type">(<a href="Lwt_log.html#TYPEsection">section</a> -> <a href="Lwt_log.html#TYPElevel">level</a> -> <a href="Lwt_log.html#TYPElogger">logger</a>) -> <a href="Lwt_log.html#TYPElogger">logger</a></code></pre><div class="info">
<code class="code">dispatch f</code> is a logger which dispatch logging instructions to
      different logger according to their level and/or section.
<p>

      Here is an example:
<p>

      <pre class="codepre"><code class="code">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;access_logger&nbsp;=&nbsp;<span class="constructor">Lwt_log</span>.file&nbsp;<span class="string">"access.log"</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">and</span>&nbsp;error_logger&nbsp;=&nbsp;<span class="constructor">Lwt_log</span>.file&nbsp;<span class="string">"error.log"</span>&nbsp;<span class="keyword">in</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="constructor">Lwt_log</span>.dispatch<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<span class="keyword">fun</span>&nbsp;section&nbsp;level&nbsp;<span class="keywordsign">-&gt;</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">match</span>&nbsp;<span class="constructor">Lwt_log</span>.<span class="constructor">Section</span>.name&nbsp;section,&nbsp;level&nbsp;<span class="keyword">with</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;<span class="string">"access"</span>,&nbsp;_&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;access_logger<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keywordsign">|</span>&nbsp;_,&nbsp;<span class="constructor">Lwt_log</span>.<span class="constructor">Error</span>&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;error_logger)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></pre><br>
</div>
<br>
<h6 id="6_Predefinedloggers">Predefined loggers</h6><br>
<pre><span id="VALnull"><span class="keyword">val</span> null</span> : <code class="type"><a href="Lwt_log.html#TYPElogger">logger</a></code></pre><div class="info">
Logger which drops everything<br>
</div>
<pre><span id="TYPEsyslog_facility"><span class="keyword">type</span> <code class="type"></code>syslog_facility</span> = <code class="type">[ `Auth<br>       | `Authpriv<br>       | `Console<br>       | `Cron<br>       | `Daemon<br>       | `FTP<br>       | `Kernel<br>       | `LPR<br>       | `Local0<br>       | `Local1<br>       | `Local2<br>       | `Local3<br>       | `Local4<br>       | `Local5<br>       | `Local6<br>       | `Local7<br>       | `Mail<br>       | `NTP<br>       | `News<br>       | `Security<br>       | `Syslog<br>       | `UUCP<br>       | `User ]</code> </pre>
<div class="info">
Syslog facility. Look at the SYSLOG(3) man page for a description
    of syslog facilities<br>
</div>

<pre><span id="VALsyslog"><span class="keyword">val</span> syslog</span> : <code class="type">?template:<a href="Lwt_log.html#TYPEtemplate">template</a> -><br>       ?paths:string list -><br>       facility:<a href="Lwt_log.html#TYPEsyslog_facility">syslog_facility</a> -> unit -> <a href="Lwt_log.html#TYPElogger">logger</a></code></pre><div class="info">
<code class="code">syslog ?template ?paths ~facility ()</code> creates an logger
      which send message to the system logger.<br>
</div>
<div class="param_info"><code class="code">template</code> : defaults to <code class="code"><span class="string">"$(date) $(name)[$(pid)]: $(section): $(message)"</span></code></div>
<div class="param_info"><code class="code">paths</code> : is a list of path to try for the syslogd socket. It
             default to <code class="code">[<span class="string">"/dev/log"</span>; <span class="string">"/var/run/log"</span>]</code>.</div>
<pre><span id="VALfile"><span class="keyword">val</span> file</span> : <code class="type">?template:<a href="Lwt_log.html#TYPEtemplate">template</a> -><br>       ?mode:[ `Append | `Truncate ] -><br>       ?perm:Unix.file_perm -> file_name:string -> unit -> <a href="Lwt_log.html#TYPElogger">logger</a> <a href="Lwt.html#TYPEt">Lwt.t</a></code></pre><div class="info">
<code class="code">desf_file ?template ?mode ?perm ~file_name ()</code> creates an
      logger which will write messages to <code class="code">file_name</code>.
<p>
<ul>
<li>if <code class="code">mode = <span class="keywordsign">`</span><span class="constructor">Truncate</span></code> then the file is truncated and previous
      contents will be lost.</li>
</ul>
<ul>
<li>if <code class="code">mode = <span class="keywordsign">`</span><span class="constructor">Append</span></code>, new messages will be appended at the end
      of the file</li>
</ul>
<br>
</div>
<div class="param_info"><code class="code">template</code> : defaults to <code class="code"><span class="string">"$(date): $(section): $(message)"</span></code></div>
<div class="param_info"><code class="code">mode</code> : defaults to <code class="code"><span class="keywordsign">`</span><span class="constructor">Append</span></code></div>
<pre><span id="VALchannel"><span class="keyword">val</span> channel</span> : <code class="type">?template:<a href="Lwt_log.html#TYPEtemplate">template</a> -><br>       close_mode:[ `Close | `Keep ] -><br>       channel:<a href="Lwt_io.html#TYPEoutput_channel">Lwt_io.output_channel</a> -> unit -> <a href="Lwt_log.html#TYPElogger">logger</a></code></pre><div class="info">
<code class="code">channel ?template ~close_mode ~channel ()</code> creates a logger
      from a channel.
<p>

      If <code class="code">close_mode = <span class="keywordsign">`</span><span class="constructor">Close</span></code> then <code class="code">channel</code> is closed when the
      logger is closed, otherwise it is left open.<br>
</div>
<div class="param_info"><code class="code">template</code> : defaults to <code class="code"><span class="string">"$(name): $(section): $(message)"</span></code></div>
</body></html>