<html>
<head>
<title>::loggerExtension::</title><style type="text/css">
    @import url(/atsdoc/css/atsdoc.css);
  </style>
</head><body bgcolor="FFFFFF">
<a name="top"></a><table border="0" cellspacing="1" cellpadding="0" width="700"><tr>
<td class="nav" width="233" align="center" valign="middle"><a href="#over">Library Header</a></td><td class="nav" width="233" align="center" valign="middle"><a href="#files">Procedure 
      Summary</a></td><td class="nav" width="233" align="center" valign="middle"><a href="#procs">Procedure 
      Details </a></td>
</tr></table><br><table border="0" cellspacing="0" cellpadding="2" width="700"><tr><td>
<a href="http://wwwin-ats.cisco.com/cgi/tcl2html.cgi?file_path=/auto/nsite-l3vpn/users/aakhter/l3vpn-proj/lib/tcl/loggerExtension/loggerExtension.tcl">
    View Code</a>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    File Name:  loggerExtension.tcl</td></tr></table><a name="over"></a><table border="0" cellspacing="0" cellpadding="2" width="700"><tr><td bgcolor="#c0c0c0" class="head1" align="center">Library Header</td></tr></table><table border="0" cellspacing="0" cellpadding="2" width="700"><tr><td bgcolor="#cccccc" height="25" class="head2">Library Name: ::loggerExtension::</td></tr></table><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
<tr><td class="key" colspan="2">Author(s)</td></tr><tr>
<td width="60">&nbsp;</td><td width="630">Aamer Akhter / aakhter@cisco.com</td>
</tr><tr><td class="key" colspan="2">Support Alias</td></tr><tr>
<td width="60">&nbsp;</td><td width="630">aakhter@cisco.com</td>
</tr><tr><td class="key" colspan="2">Purpose</td></tr><tr>
<td width="60">&nbsp;</td><td width="630">an extension to the tcllib logger module</td>
</tr><tr><td class="key" colspan="2">Description</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><p>this extension adds template based appenders </p></td>
</tr><tr><td class="key" colspan="2">Usage</td></tr><tr>
<td width="60">&nbsp;</td><td><pre><font face="Arial, Helvetica, san-serif"></font></pre></td>
</tr><tr><td class="key" colspan="2">Requirements</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><pre><font face="Arial, Helvetica, san-serif">
package require logger
</font></pre></td>
</tr><tr><td class="key" colspan="2">Variables</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><pre><font face="Arial, Helvetica, san-serif">
namespace   ::loggerExtension::
id:         CVS ID: keyword extraction
version:    current version of package
packageDir: directory where package is located
log:        instance log
</font></pre></td>
</tr><tr><td class="key" colspan="2">Notes</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><pre><font face="Arial, Helvetica, san-serif">
1.
</font></pre></td>
</tr>
</table><div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><a name="global"></a><a name="files"></a><table border="0" cellspacing="0" cellpadding="2" width="700"><tr><td bgcolor="#cccccc" class="head2">Procedures Summary</td></tr></table><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
<tr>
<td width="60">&nbsp;</td><td colspan="2"><a href="#::logger::createLogProc"><b>::logger::createLogProc</b></a></td><td width="100">&nbsp;</td>
</tr><tr>
<td width="60">&nbsp;</td><td width="60">&nbsp;</td><td>creates a customized log proc</td><td width="100">&nbsp;</td>
</tr><tr>
<td width="60">&nbsp;</td><td colspan="2"><a href="#::logger::applyAppender"><b>::logger::applyAppender</b></a></td><td width="100">&nbsp;</td>
</tr>
</table><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0"></table><br><a name="procs"></a><table border="0" cellspacing="0" cellpadding="2" width="700"><tr><td bgcolor="#cccccc" class="head2">Procedure Details</td></tr></table><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
<tr><td bgcolor="#dedede" class="head3" colspan="2">
<a name="::logger::createLogProc"></a>
   External Procedure Name: ::logger::createLogProc</td></tr><tr><td class="key" colspan="2">Purpose</td></tr><tr>
<td width="60">&nbsp;</td><td width="630">creates a customized log proc</td>
</tr><tr><td class="key" colspan="2">Synopsis</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><pre><font face="Arial, Helvetica, san-serif">
::logger::createLogProc -procName &lt;procName&gt; [options]
</font></pre></td>
</tr><tr><td class="key" colspan="2">Arguments</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><pre><font face="Arial, Helvetica, san-serif">
-procName &lt;procName&gt;
     name of proc to create
-conversionPattern &lt;pattern&gt;
     see Description for &lt;pattern&gt;
-category &lt;category&gt;
     the category (logger service) 
-priority &lt;priority&gt;
     the priority (logger level)
</font></pre></td>
</tr><tr><td class="key" colspan="2">Return Output</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><pre><font face="Arial, Helvetica, san-serif">
    a text string that is a tcl proc of name &lt;procName&gt;. It will need
        need to be eval'd to add to tcl's proc base
</font></pre></td>
</tr><tr><td class="key" colspan="2">Description</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><p>createLogProc creates a custom logger log proc with 
specified attributes. </p><p>The following are the current &lt;pattern&gt; substitutions (from log4perl):
%c category of the logging event
%C fully qualified name of logging event
%d current date in yyyy/MM/dd hh:mm:ss
%H hostname
%m message to be logged
%M method where logging event was issued
%p priority of logging event
%P pid of current process </p></td>
</tr><tr><td class="key" colspan="2">Examples</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% set p [logger::createLogProc \
             -category catTest \
             -priority critical \
             -procName ::testProc \
              -conversionPattern {\[%d\] \[%c\] \[%M\] \[%p\] %m}
% eval $p
% ::testProc 'this is a test'
[2005/09/30 23:15:52] [catTest] [global] [critical] this is a test

 End of Procedure Header
</font></pre></td>
</tr>
</table><div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
<tr><td bgcolor="#dedede" class="head3" colspan="2">
<a name="::logger::applyAppender"></a>
   External Procedure Name: ::logger::applyAppender</td></tr><tr><td class="key" colspan="2">Synopsis</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><pre><font face="Arial, Helvetica, san-serif">
::logger::applyAppender -appender &lt;appenderType&gt; [options]
</font></pre></td>
</tr><tr><td class="key" colspan="2">Arguments</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><pre><font face="Arial, Helvetica, san-serif">
-service &lt;logger service names&gt;
-serviceCmd &lt;logger serviceCmds&gt;
     name of logger instance to modify
     -serviceCmd takes as input the return of logger::init

-appender &lt;appenderType&gt;
     type of appender to use
      console|colorConsole...

-conversionPattern &lt;pattern&gt;
     see createLogProc for format
     if not provided the default pattern
     is used:
      {\[%d\] \[%c\] \[%M\] \[%p\] %m}

-levels &lt;levels to apply to&gt;
     list of levels to apply this appender to
     by default all levels are applied to
</font></pre></td>
</tr><tr><td class="key" colspan="2">Description</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><p>applyAppender will create an appender for the specified 
logger services. If not service is specified then the 
appender will be added as the default appender for 
the specified levels. If no levels are specified, then
all levels are assumed. </p><p>The following are the known substitutions (from log4perl):
%c category of the logging event
%C fully qualified name of logging event
%d current date in yyyy/MM/dd hh:mm:ss
%H hostname
%m message to be logged
%M method where logging event was issued
%p priority of logging event
%P pid of current process </p></td>
</tr><tr><td class="key" colspan="2">Examples</td></tr><tr>
<td width="60">&nbsp;</td><td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% set log [logger::init testLog]
::logger::tree::testLog
% logger::applyAppender -appender console -serviceCmd $log
% ${log}::error 'this is error'
[2005/08/22 10:14:13] [testLog] [global] [error] this is error


 End of Procedure Header
</font></pre></td>
</tr>
</table><div style="position: absolute; left: 685px"><a href="#top">Top</a></div><a name="over"></a><p>&nbsp;</p><div style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"><table width="700" border="0" cellspacing="2" cellpadding="2"><tr><td><div style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<strong>Copyright (c) Cisco Systems, Inc. 
            <a href="http://wwwin.cisco.com/infosec/policies/info_sensitivity.html">Internal 
            Use Only</a>
</strong><br><script language="JavaScript">
               document.write("Last Modified on: " + document.lastModified );
            </script>
</div></td></tr></table></div>
</body>
</html>
