<!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="BatList.html"> <link rel="next" href="BatLogger.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 methods" rel=Appendix href="index_methods.html"> <link title="Index of classes" rel=Appendix href="index_classes.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="BatArray" rel="Chapter" href="BatArray.html"> <link title="BatAvlTree" rel="Chapter" href="BatAvlTree.html"> <link title="BatBase64" rel="Chapter" href="BatBase64.html"> <link title="BatBig_int" rel="Chapter" href="BatBig_int.html"> <link title="BatBigarray" rel="Chapter" href="BatBigarray.html"> <link title="BatBitSet" rel="Chapter" href="BatBitSet.html"> <link title="BatBool" rel="Chapter" href="BatBool.html"> <link title="BatBounded" rel="Chapter" href="BatBounded.html"> <link title="BatBuffer" rel="Chapter" href="BatBuffer.html"> <link title="BatCache" rel="Chapter" href="BatCache.html"> <link title="BatChar" rel="Chapter" href="BatChar.html"> <link title="BatCharParser" rel="Chapter" href="BatCharParser.html"> <link title="BatComplex" rel="Chapter" href="BatComplex.html"> <link title="BatConcurrent" rel="Chapter" href="BatConcurrent.html"> <link title="BatDeque" rel="Chapter" href="BatDeque.html"> <link title="BatDigest" rel="Chapter" href="BatDigest.html"> <link title="BatDllist" rel="Chapter" href="BatDllist.html"> <link title="BatDynArray" rel="Chapter" href="BatDynArray.html"> <link title="BatEnum" rel="Chapter" href="BatEnum.html"> <link title="BatFile" rel="Chapter" href="BatFile.html"> <link title="BatFingerTree" rel="Chapter" href="BatFingerTree.html"> <link title="BatFloat" rel="Chapter" href="BatFloat.html"> <link title="BatFormat" rel="Chapter" href="BatFormat.html"> <link title="BatGc" rel="Chapter" href="BatGc.html"> <link title="BatGenlex" rel="Chapter" href="BatGenlex.html"> <link title="BatGlobal" rel="Chapter" href="BatGlobal.html"> <link title="BatHashcons" rel="Chapter" href="BatHashcons.html"> <link title="BatHashtbl" rel="Chapter" href="BatHashtbl.html"> <link title="BatHeap" rel="Chapter" href="BatHeap.html"> <link title="BatIMap" rel="Chapter" href="BatIMap.html"> <link title="BatIO" rel="Chapter" href="BatIO.html"> <link title="BatISet" rel="Chapter" href="BatISet.html"> <link title="BatInnerIO" rel="Chapter" href="BatInnerIO.html"> <link title="BatInnerPervasives" rel="Chapter" href="BatInnerPervasives.html"> <link title="BatInnerWeaktbl" rel="Chapter" href="BatInnerWeaktbl.html"> <link title="BatInt" rel="Chapter" href="BatInt.html"> <link title="BatInt32" rel="Chapter" href="BatInt32.html"> <link title="BatInt64" rel="Chapter" href="BatInt64.html"> <link title="BatInterfaces" rel="Chapter" href="BatInterfaces.html"> <link title="BatLazyList" rel="Chapter" href="BatLazyList.html"> <link title="BatLexing" rel="Chapter" href="BatLexing.html"> <link title="BatList" rel="Chapter" href="BatList.html"> <link title="BatLog" rel="Chapter" href="BatLog.html"> <link title="BatLogger" rel="Chapter" href="BatLogger.html"> <link title="BatMap" rel="Chapter" href="BatMap.html"> <link title="BatMarshal" rel="Chapter" href="BatMarshal.html"> <link title="BatMultiMap" rel="Chapter" href="BatMultiMap.html"> <link title="BatMultiPMap" rel="Chapter" href="BatMultiPMap.html"> <link title="BatMutex" rel="Chapter" href="BatMutex.html"> <link title="BatNativeint" rel="Chapter" href="BatNativeint.html"> <link title="BatNum" rel="Chapter" href="BatNum.html"> <link title="BatNumber" rel="Chapter" href="BatNumber.html"> <link title="BatOo" rel="Chapter" href="BatOo.html"> <link title="BatOptParse" rel="Chapter" href="BatOptParse.html"> <link title="BatOption" rel="Chapter" href="BatOption.html"> <link title="BatOrd" rel="Chapter" href="BatOrd.html"> <link title="BatParserCo" rel="Chapter" href="BatParserCo.html"> <link title="BatPathGen" rel="Chapter" href="BatPathGen.html"> <link title="BatPervasives" rel="Chapter" href="BatPervasives.html"> <link title="BatPrintexc" rel="Chapter" href="BatPrintexc.html"> <link title="BatPrintf" rel="Chapter" href="BatPrintf.html"> <link title="BatQueue" rel="Chapter" href="BatQueue.html"> <link title="BatRMutex" rel="Chapter" href="BatRMutex.html"> <link title="BatRandom" rel="Chapter" href="BatRandom.html"> <link title="BatRef" rel="Chapter" href="BatRef.html"> <link title="BatRefList" rel="Chapter" href="BatRefList.html"> <link title="BatResult" rel="Chapter" href="BatResult.html"> <link title="BatReturn" rel="Chapter" href="BatReturn.html"> <link title="BatScanf" rel="Chapter" href="BatScanf.html"> <link title="BatSeq" rel="Chapter" href="BatSeq.html"> <link title="BatSet" rel="Chapter" href="BatSet.html"> <link title="BatSplay" rel="Chapter" href="BatSplay.html"> <link title="BatStack" rel="Chapter" href="BatStack.html"> <link title="BatStream" rel="Chapter" href="BatStream.html"> <link title="BatString" rel="Chapter" href="BatString.html"> <link title="BatSubstring" rel="Chapter" href="BatSubstring.html"> <link title="BatSys" rel="Chapter" href="BatSys.html"> <link title="BatText" rel="Chapter" href="BatText.html"> <link title="BatTuple" rel="Chapter" href="BatTuple.html"> <link title="BatUChar" rel="Chapter" href="BatUChar.html"> <link title="BatUTF8" rel="Chapter" href="BatUTF8.html"> <link title="BatUnit" rel="Chapter" href="BatUnit.html"> <link title="BatUnix" rel="Chapter" href="BatUnix.html"> <link title="BatUref" rel="Chapter" href="BatUref.html"> <link title="BatVect" rel="Chapter" href="BatVect.html"> <link title="Batteries" rel="Chapter" href="Batteries.html"> <link title="BatteriesConfig" rel="Chapter" href="BatteriesConfig.html"> <link title="BatteriesPrint" rel="Chapter" href="BatteriesPrint.html"> <link title="BatteriesThread" rel="Chapter" href="BatteriesThread.html"> <link title="Extlib" rel="Chapter" href="Extlib.html"><title>Batteries user guide : BatLog</title> </head> <body> <div class="navbar"><a class="pre" href="BatList.html" title="BatList">Previous</a> <a class="up" href="index.html" title="Index">Up</a> <a class="post" href="BatLogger.html" title="BatLogger">Next</a> </div> <h1>Module <a href="type_BatLog.html">BatLog</a></h1> <pre><span class="keyword">module</span> BatLog: <code class="code"><span class="keyword">sig</span></code> <a href="BatLog.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top"> Simple logging<br> <b>Author(s):</b> Edgar Friendly<br> </div> <hr width="100%"> <pre><span id="VALoutput"><span class="keyword">val</span> output</span> : <code class="type">unit <a href="BatIO.html#TYPEoutput">BatIO.output</a> Pervasives.ref</code></pre><div class="info "> This ref holds the output channel for simple logging. Defaults to <code class="code">stderr</code><br> <b>Since</b> 2.0; had getter and setter in 1.x<br> </div> <pre><span id="VALprefix"><span class="keyword">val</span> prefix</span> : <code class="type">string Pervasives.ref</code></pre><div class="info "> This ref holds the text printed before each log message. Defaults to the empty string.<br> <b>Since</b> 2.0; had getter and setter in 1.x<br> </div> <pre><span id="TYPEflag"><span class="keyword">type</span> <code class="type"></code>flag</span> = <code class="type">[ `Custom of unit -> string | `Date | `Filepos | `Time ]</code> </pre> <pre><span id="VALflags"><span class="keyword">val</span> flags</span> : <code class="type"><a href="BatLog.html#TYPEflag">flag</a> list Pervasives.ref</code></pre><div class="info "> This ref holds the output flags. These flags control how the log messages are output. The default is <code class="code"><span class="keywordsign">`</span><span class="constructor">Date</span>; <span class="keywordsign">`</span><span class="constructor">Time</span></code> and log messages are printed as: <p> 2011/0628 01:23:45: prefixmessage<br> <b>Since</b> 2.0; had getter and setter in 1.x<br> </div> <pre><span id="VALlog"><span class="keyword">val</span> log</span> : <code class="type">?fp:string -> string -> unit</code></pre><div class="info "> <code class="code">log s</code> logs the message s, returning unit.<br> <b>Since</b> 2.0; was [print] in 1.x<br> </div> <pre><span id="VALlogf"><span class="keyword">val</span> logf</span> : <code class="type">?fp:string -> ('a, unit <a href="BatIO.html#TYPEoutput">BatIO.output</a>, unit) Pervasives.format -> 'a</code></pre><div class="info "> As <code class="code"><span class="constructor">Printf</span>.printf</code>, only the message is printed to the logging output and prefixed with status information per the current flags and the currently set prefix.<br> <b>Since</b> 2.0; was [printf] in 1.x<br> </div> <pre><span id="VALfatal"><span class="keyword">val</span> fatal</span> : <code class="type">?fp:string -> string -> 'a</code></pre><div class="info "> <code class="code">fatal s</code> logs the message <code class="code">s</code> and then calls <code class="code">exit 1</code>. This exits the program with return code 1.<br> </div> <pre><span id="VALfatalf"><span class="keyword">val</span> fatalf</span> : <code class="type">?fp:string -> ('a, unit <a href="BatIO.html#TYPEoutput">BatIO.output</a>, unit) Pervasives.format -> 'a</code></pre><div class="info "> <code class="code">fatalf</code> allows a format string (as <code class="code"><span class="constructor">Printf</span>.printf</code>)and the arguments to that format string to build the logging message. Exits the program with return code 1.<br> </div> <pre><span class="keyword">module type</span> <a href="BatLog.Config.html">Config</a> = <code class="code"><span class="keyword">sig</span></code> <a href="BatLog.Config.html">..</a> <code class="code"><span class="keyword">end</span></code></pre> <pre><span class="keyword">module</span> <a href="BatLog.Make.html">Make</a>: <div class="sig_block"><code class="code"><span class="keyword">functor</span> (</code><code class="code"><span class="constructor">S</span></code><code class="code"> : </code><code class="type"><a href="BatLog.Config.html">Config</a></code><code class="code">) <span class="keywordsign">-></span> </code><code class="code"><span class="keyword">sig</span></code> <a href="BatLog.Make.html">..</a> <code class="code"><span class="keyword">end</span></code></div></pre><div class="info"> Build a logger module with custom, fixed output, prefix and flags </div> <br> Returns an object with methods <code class="code">fatal</code>, <code class="code">fatalf</code>, <code class="code">log</code>, and <code class="code">logf</code> that logs to the given output channel, with given prefix and flags. These methods work like the corresponding functions in the BatLog module.<br> <pre><span id="VALmake_logger"><span class="keyword">val</span> make_logger</span> : <code class="type">'a <a href="BatIO.html#TYPEoutput">BatIO.output</a> -><br> string -><br> [< `Custom of unit -> string | `Date | `Filepos | `Time ] list -><br> < fatal : ?fp:string -> string -> 'b;<br> fatalf : ?fp:string -><br> ('c, 'a <a href="BatIO.html#TYPEoutput">BatIO.output</a>, unit, unit, unit, 'd) format6 -> 'c;<br> log : ?fp:string -> string -> unit;<br> logf : ?fp:string -> ('e, 'a <a href="BatIO.html#TYPEoutput">BatIO.output</a>, unit) Pervasives.format -> 'e ></code></pre> <pre><span id="TYPEeasy_lev"><span class="keyword">type</span> <code class="type"></code>easy_lev</span> = <code class="type">[ `always | `debug | `error | `fatal | `info | `trace | `warn ]</code> </pre> <div class="info "> The different verbosity levels supported in the <code class="code"><span class="constructor">Easy</span></code> logger<br> </div> <pre><span class="keyword">module</span> <a href="BatLog.Easy.html">Easy</a>: <code class="code"><span class="keyword">sig</span></code> <a href="BatLog.Easy.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info"> A simple-to-use logger with verbosity levels that outputs by default to stderr (changeable at runtime) with the date and time at the beginning of each log message. </div> <pre><span class="keyword">module type</span> <a href="BatLog.Level_sig.html">Level_sig</a> = <code class="code"><span class="keyword">sig</span></code> <a href="BatLog.Level_sig.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info"> The details of a level scheme for verbosity-level loggers </div> <pre><span class="keyword">module</span> <a href="BatLog.Make_lev.html">Make_lev</a>: <div class="sig_block"><code class="code"><span class="keyword">functor</span> (</code><code class="code"><span class="constructor">L</span></code><code class="code"> : </code><code class="type"><a href="BatLog.Level_sig.html">Level_sig</a></code><code class="code">) <span class="keywordsign">-></span> </code><div class="sig_block"><code class="code"><span class="keyword">functor</span> (</code><code class="code"><span class="constructor">S</span></code><code class="code"> : </code><code class="type"><a href="BatLog.Config.html">Config</a></code><code class="code">) <span class="keywordsign">-></span> </code><code class="code"><span class="keyword">sig</span></code> <a href="BatLog.Make_lev.html">..</a> <code class="code"><span class="keyword">end</span></code></div></div></pre><div class="info"> Make your own level-based logger, like <code class="code"><span class="constructor">Easy</span></code> </div> </body></html>