delphimvcframework/lib/loggerpro/docs/LoggerPro.html

231 lines
10 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>LoggerPro: LoggerPro</title>
<meta name="generator" content="PasDoc 0.14.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<table class="container"><tr><td class="navigation">
<h2>LoggerPro</h2><p><a href="AllUnits.html" class="navigation">Units</a></p><p><a href="ClassHierarchy.html" class="navigation">Class Hierarchy</a></p><p><a href="AllClasses.html" class="navigation">Classes, Interfaces, Objects and Records</a></p><p><a href="AllTypes.html" class="navigation">Types</a></p><p><a href="AllVariables.html" class="navigation">Variables</a></p><p><a href="AllConstants.html" class="navigation">Constants</a></p><p><a href="AllFunctions.html" class="navigation">Functions and Procedures</a></p><p><a href="AllIdentifiers.html" class="navigation">Identifiers</a></p></td><td class="content">
<h2>LoggerPro (1.0)</h2><p>A simple, pluggable and modern logging framework for Delphi</p>
<h1 class="unit">Unit LoggerPro</h1>
<table class="sections wide_list">
<tr>
<td><a class="section" href="#PasDoc-Description">Description</a></td><td><a class="section" href="#PasDoc-Uses">Uses</a></td><td><a class="section" href="#PasDoc-Classes">Classes, Interfaces, Objects and Records</a></td><td><a class="section" href="#PasDoc-FuncsProcs">Functions and Procedures</a></td><td><a class="section" href="#PasDoc-Types">Types</a></td><td>Constants</td><td><a class="section" href="#PasDoc-Variables">Variables</a></td></tr></table>
<a name="PasDoc-Description"></a><h2 class="description">Description</h2>
&nbsp;<a name="PasDoc-Uses"></a><h2 class="uses">Uses</h2>
<ul class="useslist"><li>System.Generics.Collections</li><li>System.SysUtils</li><li>System.Classes</li></ul><h2 class="overview">Overview</h2>
<a name="PasDoc-Classes"></a><h3 class="cio">Classes, Interfaces, Objects and Records</h3>
<table class="classestable wide_list">
<tr class="listheader">
<th class="itemname">Name</th>
<th class="itemdesc">Description</th>
</tr>
<tr class="list">
<td class="itemname">Class&nbsp;<a class="bold" href="LoggerPro.TLogItem.html"><code>TLogItem</code></a></td>
<td class="itemdesc">Represent the single log item</td>
</tr>
<tr class="list2">
<td class="itemname">Class&nbsp;<a class="bold" href="LoggerPro.TLoggerProEventsHandler.html"><code>TLoggerProEventsHandler</code></a></td>
<td class="itemdesc">&nbsp;</td>
</tr>
<tr class="list">
<td class="itemname">Interface&nbsp;<a class="bold" href="LoggerPro.ILogAppender.html"><code>ILogAppender</code></a></td>
<td class="itemdesc">Interface implemented by all the classes used as appenders</td>
</tr>
<tr class="list2">
<td class="itemname">Class&nbsp;<a class="bold" href="LoggerPro.ELoggerPro.html"><code>ELoggerPro</code></a></td>
<td class="itemdesc">&nbsp;</td>
</tr>
<tr class="list">
<td class="itemname">Interface&nbsp;<a class="bold" href="LoggerPro.ILogWriter.html"><code>ILogWriter</code></a></td>
<td class="itemdesc">&nbsp;</td>
</tr>
<tr class="list2">
<td class="itemname">Class&nbsp;<a class="bold" href="LoggerPro.TLoggerThread.html"><code>TLoggerThread</code></a></td>
<td class="itemdesc">&nbsp;</td>
</tr>
<tr class="list">
<td class="itemname">Class&nbsp;<a class="bold" href="LoggerPro.TLogWriter.html"><code>TLogWriter</code></a></td>
<td class="itemdesc">&nbsp;</td>
</tr>
<tr class="list2">
<td class="itemname">Class&nbsp;<a class="bold" href="LoggerPro.TLoggerProAppenderBase.html"><code>TLoggerProAppenderBase</code></a></td>
<td class="itemdesc">&nbsp;</td>
</tr>
</table>
<a name="PasDoc-FuncsProcs"></a><h3 class="summary">Functions and Procedures</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code>function <b><a href="LoggerPro.html#BuildLogWriter">BuildLogWriter</a></b>(aAppenders: array of <a href="LoggerPro.ILogAppender.html">ILogAppender</a>; aEventsHandlers: <a href="LoggerPro.TLoggerProEventsHandler.html">TLoggerProEventsHandler</a> = nil; aLogLevel: <a href="LoggerPro.html#TLogType">TLogType</a> = TLogType.Debug): <a href="LoggerPro.ILogWriter.html">ILogWriter</a>;</code></td>
</tr>
</table>
<a name="PasDoc-Types"></a><h3 class="summary">Types</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code><b><a href="LoggerPro.html#TLogType">TLogType</a></b> = (...);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="LoggerPro.html#TLogErrorReason">TLogErrorReason</a></b> = (...);</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="LoggerPro.html#TLogErrorAction">TLogErrorAction</a></b> = (...);</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="LoggerPro.html#TLoggerProAppenderErrorEvent">TLoggerProAppenderErrorEvent</a></b> = reference to procedure(const AppenderClassName
: string; const aFailedLogItem: <a href="LoggerPro.TLogItem.html">TLogItem</a>; const Reason: <a href="LoggerPro.html#TLogErrorReason">TLogErrorReason</a>;
var Action: <a href="LoggerPro.html#TLogErrorAction">TLogErrorAction</a>);</code></td>
</tr>
<tr class="list">
<td class="itemcode"><code><b><a href="LoggerPro.html#TLogAppenderList">TLogAppenderList</a></b> = TList&lt;<a href="LoggerPro.ILogAppender.html">ILogAppender</a>&gt;;</code></td>
</tr>
</table>
<a name="PasDoc-Variables"></a><h3 class="summary">Variables</h3>
<table class="summary wide_list">
<tr class="list">
<td class="itemcode"><code><b><a href="LoggerPro.html#DefaultLoggerProMainQueueSize">DefaultLoggerProMainQueueSize</a></b>: Cardinal = 100000;</code></td>
</tr>
<tr class="list2">
<td class="itemcode"><code><b><a href="LoggerPro.html#DefaultLoggerProAppenderQueueSize">DefaultLoggerProAppenderQueueSize</a></b>: Cardinal = 10000;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Functions and Procedures</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="BuildLogWriter"></a><code>function <b>BuildLogWriter</b>(aAppenders: array of <a href="LoggerPro.ILogAppender.html">ILogAppender</a>; aEventsHandlers: <a href="LoggerPro.TLoggerProEventsHandler.html">TLoggerProEventsHandler</a> = nil; aLogLevel: <a href="LoggerPro.html#TLogType">TLogType</a> = TLogType.Debug): <a href="LoggerPro.ILogWriter.html">ILogWriter</a>;</code></td>
</tr>
<tr><td colspan="1">
<p>
Builds a new ILogWriter instance. Call this global function to start logging like a pro.</p>
<p>
Here's a sample unit that you can use in your code </p>
<pre class="longcode">
<span class="pascal_keyword">unit</span> LoggerProConfig;
<span class="pascal_keyword">interface</span>
<span class="pascal_keyword">uses</span>
LoggerPro;
<span class="pascal_keyword">function</span> Log: ILogWriter;
<span class="pascal_keyword">implementation</span>
<span class="pascal_keyword">uses</span>
LoggerPro.FileAppender;
<span class="pascal_keyword">var</span>
_Log: ILogWriter;
<span class="pascal_keyword">function</span> Log: ILogWriter;
<span class="pascal_keyword">begin</span>
Result := _Log;
<span class="pascal_keyword">end</span>;
<span class="pascal_keyword">initialization</span>
<span class="pascal_comment">//If you need other appenders, feel free to add them here in the array</span>
_Log := BuildLogWriter([TLoggerProFileAppender.Create(<span class="pascal_numeric">10</span>, <span class="pascal_numeric">5</span>)]);
<span class="pascal_keyword">end</span>.
</pre>
<p>
<p>Add this unit to your project, then when you need to use the logger, include the unit and call one of the followings: </p>
<ul class="paragraph_spacing">
<li><p>Log.Debug('This is a debug message', 'tag1')</p></li>
<li><p>Log.Info('This is an information message', 'tag1')</p></li>
<li><p>Log.Warn('This is a warning message', 'tag1')</p></li>
<li><p>Log.Error('This is an error message', 'tag1')</p></li>
</ul>
<p></p>
</td></tr>
</table>
<h3 class="detail">Types</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TLogType"></a><code><b>TLogType</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
&nbsp;<h6 class="description_section">Values</h6>
<ul>
<li>
Debug = 0: &nbsp;</li>
<li>
Info: &nbsp;</li>
<li>
Warning: &nbsp;</li>
<li>
Error: &nbsp;</li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TLogErrorReason"></a><code><b>TLogErrorReason</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
&nbsp;<h6 class="description_section">Values</h6>
<ul>
<li>
QueueFull: &nbsp;</li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TLogErrorAction"></a><code><b>TLogErrorAction</b> = (...);</code></td>
</tr>
<tr><td colspan="1">
&nbsp;<h6 class="description_section">Values</h6>
<ul>
<li>
Skip: &nbsp;</li>
<li>
DisableAppender: &nbsp;</li>
</ul>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TLoggerProAppenderErrorEvent"></a><code><b>TLoggerProAppenderErrorEvent</b> = reference to procedure(const AppenderClassName
: string; const aFailedLogItem: <a href="LoggerPro.TLogItem.html">TLogItem</a>; const Reason: <a href="LoggerPro.html#TLogErrorReason">TLogErrorReason</a>;
var Action: <a href="LoggerPro.html#TLogErrorAction">TLogErrorAction</a>);</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="TLogAppenderList"></a><code><b>TLogAppenderList</b> = TList&lt;<a href="LoggerPro.ILogAppender.html">ILogAppender</a>&gt;;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<h3 class="detail">Variables</h3>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="DefaultLoggerProMainQueueSize"></a><code><b>DefaultLoggerProMainQueueSize</b>: Cardinal = 100000;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="itemcode"><a name="DefaultLoggerProAppenderQueueSize"></a><code><b>DefaultLoggerProAppenderQueueSize</b>: Cardinal = 10000;</code></td>
</tr>
<tr><td colspan="1">
&nbsp;</td></tr>
</table>
Copyright 2016 Daniele Teti
<hr noshade size="1"><span class="appinfo"><em>Generated by <a href="http://pasdoc.sourceforge.net/">PasDoc 0.14.0</a>. </em>
</span>
</td></tr></table></body></html>