14 lines
7.9 KiB
HTML
14 lines
7.9 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>System.Log.Formatter</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
|
window.onload = function () {pageLoad();setSynopsis("mini_System-Log-Formatter.html");};
|
|
//]]>
|
|
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">hslogger-1.2.8: Versatile logging framework</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Safe</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">System.Log.Formatter</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Definition of log formatter support</p><p>A few basic, and extendable formatters are defined.</p><p>Please see <a href="System-Log-Logger.html">System.Log.Logger</a> for extensive documentation on the
|
|
logging system.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">type</span> <a href="#t:LogFormatter">LogFormatter</a> a = a -> <a href="System-Log.html#t:LogRecord">LogRecord</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:nullFormatter">nullFormatter</a> :: <a href="System-Log-Formatter.html#t:LogFormatter">LogFormatter</a> a</li><li class="src short"><a href="#v:simpleLogFormatter">simpleLogFormatter</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="System-Log-Formatter.html#t:LogFormatter">LogFormatter</a> a</li><li class="src short"><a href="#v:tfLogFormatter">tfLogFormatter</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="System-Log-Formatter.html#t:LogFormatter">LogFormatter</a> a</li><li class="src short"><a href="#v:varFormatter">varFormatter</a> :: [(<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)] -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="System-Log-Formatter.html#t:LogFormatter">LogFormatter</a> a</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:LogFormatter" class="def">LogFormatter</a> a</p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src"> = a</td><td class="doc"><p>The LogHandler that the passed message came from </p></td></tr><tr><td class="src">-> <a href="System-Log.html#t:LogRecord">LogRecord</a></td><td class="doc"><p>The log message and priority</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The logger name</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The formatted log message</p></td></tr></table></div><div class="doc"><p>A LogFormatter is used to format log messages. Note that it is paramterized on the
|
|
<code>Handler</code> to allow the formatter to use information specific to the handler
|
|
(an example of can be seen in the formatter used in <code><a href="System-Log-Handler.html#t:Syslog">Syslog</a></code>)</p></div></div><div class="top"><p class="src"><a name="v:nullFormatter" class="def">nullFormatter</a> :: <a href="System-Log-Formatter.html#t:LogFormatter">LogFormatter</a> a</p><div class="doc"><p>Returns the passed message as is, ie. no formatting is done.</p></div></div><div class="top"><p class="src"><a name="v:simpleLogFormatter" class="def">simpleLogFormatter</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="System-Log-Formatter.html#t:LogFormatter">LogFormatter</a> a</p><div class="doc"><p>Takes a format string, and returns a formatter that may be used to
|
|
format log messages. The format string may contain variables prefixed with
|
|
a $-sign which will be replaced at runtime with corresponding values. The
|
|
currently supported variables are:</p><ul><li><p><code>$msg</code> - The actual log message</p><ul><li><code>$loggername</code> - The name of the logger</li><li><code>$prio</code> - The priority level of the message</li><li><code>$tid</code> - The thread ID</li><li><code>$pid</code> - Process ID (Not available on windows)</li><li><code>$time</code> - The current time </li><li><code>$utcTime</code> - The current time in UTC Time</li></ul></li></ul></div></div><div class="top"><p class="src"><a name="v:tfLogFormatter" class="def">tfLogFormatter</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="System-Log-Formatter.html#t:LogFormatter">LogFormatter</a> a</p><div class="doc"><p>Like <code><a href="System-Log-Formatter.html#v:simpleLogFormatter">simpleLogFormatter</a></code> but allow the time format to be specified in the first
|
|
parameter (this is passed to <code><a href="Date-Time-Format.html#v:formatTime">formatTime</a></code>)</p></div></div><div class="top"><p class="src"><a name="v:varFormatter" class="def">varFormatter</a> :: [(<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)] -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="System-Log-Formatter.html#t:LogFormatter">LogFormatter</a> a</p><div class="doc"><p>An extensible formatter that allows new substition <em>variables</em> to be defined.
|
|
Each variable has an associated IO action that is used to produce the
|
|
string to substitute for the variable name. The predefined variables are the same
|
|
as for <code><a href="System-Log-Formatter.html#v:simpleLogFormatter">simpleLogFormatter</a></code> <em>excluding</em> <code>$time</code> and <code>$utcTime</code>.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.0</p></div></body></html> |