3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-30 14:49:28 +01:00
PyLink/docs/technical/autogen/log.html
2016-05-11 21:56:02 -07:00

165 lines
11 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module log</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>log</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/gl/pylink/log.py">/home/gl/pylink/log.py</a></font></td></tr></table>
<p><tt>log.py&nbsp;-&nbsp;PyLink&nbsp;logging&nbsp;module.<br>
&nbsp;<br>
This&nbsp;module&nbsp;contains&nbsp;the&nbsp;logging&nbsp;portion&nbsp;of&nbsp;the&nbsp;PyLink&nbsp;framework.&nbsp;Plugins&nbsp;can<br>
access&nbsp;the&nbsp;global&nbsp;logger&nbsp;object&nbsp;by&nbsp;importing&nbsp;"log"&nbsp;from&nbsp;this&nbsp;module<br>
(from&nbsp;log&nbsp;import&nbsp;log).</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="logging.html">logging</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td><td width="25%" valign=top><a href="world.html">world</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="logging.html#Handler">logging.Handler</a>(<a href="logging.html#Filterer">logging.Filterer</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="log.html#PyLinkChannelLogger">PyLinkChannelLogger</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="PyLinkChannelLogger">class <strong>PyLinkChannelLogger</strong></a>(<a href="logging.html#Handler">logging.Handler</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Log&nbsp;handler&nbsp;to&nbsp;log&nbsp;to&nbsp;channels&nbsp;in&nbsp;PyLink.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="log.html#PyLinkChannelLogger">PyLinkChannelLogger</a></dd>
<dd><a href="logging.html#Handler">logging.Handler</a></dd>
<dd><a href="logging.html#Filterer">logging.Filterer</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="PyLinkChannelLogger-__init__"><strong>__init__</strong></a>(self, irc, channel, level=None)</dt></dl>
<dl><dt><a name="PyLinkChannelLogger-emit"><strong>emit</strong></a>(self, record)</dt><dd><tt>Logs&nbsp;a&nbsp;record&nbsp;to&nbsp;the&nbsp;configured&nbsp;channels&nbsp;for&nbsp;the&nbsp;network&nbsp;given.</tt></dd></dl>
<hr>
Methods inherited from <a href="logging.html#Handler">logging.Handler</a>:<br>
<dl><dt><a name="PyLinkChannelLogger-acquire"><strong>acquire</strong></a>(self)</dt><dd><tt>Acquire&nbsp;the&nbsp;I/O&nbsp;thread&nbsp;lock.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-close"><strong>close</strong></a>(self)</dt><dd><tt>Tidy&nbsp;up&nbsp;any&nbsp;resources&nbsp;used&nbsp;by&nbsp;the&nbsp;handler.<br>
&nbsp;<br>
This&nbsp;version&nbsp;removes&nbsp;the&nbsp;handler&nbsp;from&nbsp;an&nbsp;internal&nbsp;map&nbsp;of&nbsp;handlers,<br>
_handlers,&nbsp;which&nbsp;is&nbsp;used&nbsp;for&nbsp;handler&nbsp;lookup&nbsp;by&nbsp;name.&nbsp;Subclasses<br>
should&nbsp;ensure&nbsp;that&nbsp;this&nbsp;gets&nbsp;called&nbsp;from&nbsp;overridden&nbsp;<a href="#PyLinkChannelLogger-close">close</a>()<br>
methods.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-createLock"><strong>createLock</strong></a>(self)</dt><dd><tt>Acquire&nbsp;a&nbsp;thread&nbsp;lock&nbsp;for&nbsp;serializing&nbsp;access&nbsp;to&nbsp;the&nbsp;underlying&nbsp;I/O.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-flush"><strong>flush</strong></a>(self)</dt><dd><tt>Ensure&nbsp;all&nbsp;logging&nbsp;output&nbsp;has&nbsp;been&nbsp;flushed.<br>
&nbsp;<br>
This&nbsp;version&nbsp;does&nbsp;nothing&nbsp;and&nbsp;is&nbsp;intended&nbsp;to&nbsp;be&nbsp;implemented&nbsp;by<br>
subclasses.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-format"><strong>format</strong></a>(self, record)</dt><dd><tt>Format&nbsp;the&nbsp;specified&nbsp;record.<br>
&nbsp;<br>
If&nbsp;a&nbsp;formatter&nbsp;is&nbsp;set,&nbsp;use&nbsp;it.&nbsp;Otherwise,&nbsp;use&nbsp;the&nbsp;default&nbsp;formatter<br>
for&nbsp;the&nbsp;module.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-get_name"><strong>get_name</strong></a>(self)</dt></dl>
<dl><dt><a name="PyLinkChannelLogger-handle"><strong>handle</strong></a>(self, record)</dt><dd><tt>Conditionally&nbsp;emit&nbsp;the&nbsp;specified&nbsp;logging&nbsp;record.<br>
&nbsp;<br>
Emission&nbsp;depends&nbsp;on&nbsp;filters&nbsp;which&nbsp;may&nbsp;have&nbsp;been&nbsp;added&nbsp;to&nbsp;the&nbsp;handler.<br>
Wrap&nbsp;the&nbsp;actual&nbsp;emission&nbsp;of&nbsp;the&nbsp;record&nbsp;with&nbsp;acquisition/release&nbsp;of<br>
the&nbsp;I/O&nbsp;thread&nbsp;lock.&nbsp;Returns&nbsp;whether&nbsp;the&nbsp;filter&nbsp;passed&nbsp;the&nbsp;record&nbsp;for<br>
emission.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-handleError"><strong>handleError</strong></a>(self, record)</dt><dd><tt>Handle&nbsp;errors&nbsp;which&nbsp;occur&nbsp;during&nbsp;an&nbsp;<a href="#PyLinkChannelLogger-emit">emit</a>()&nbsp;call.<br>
&nbsp;<br>
This&nbsp;method&nbsp;should&nbsp;be&nbsp;called&nbsp;from&nbsp;handlers&nbsp;when&nbsp;an&nbsp;exception&nbsp;is<br>
encountered&nbsp;during&nbsp;an&nbsp;<a href="#PyLinkChannelLogger-emit">emit</a>()&nbsp;call.&nbsp;If&nbsp;raiseExceptions&nbsp;is&nbsp;false,<br>
exceptions&nbsp;get&nbsp;silently&nbsp;ignored.&nbsp;This&nbsp;is&nbsp;what&nbsp;is&nbsp;mostly&nbsp;wanted<br>
for&nbsp;a&nbsp;logging&nbsp;system&nbsp;-&nbsp;most&nbsp;users&nbsp;will&nbsp;not&nbsp;care&nbsp;about&nbsp;errors&nbsp;in<br>
the&nbsp;logging&nbsp;system,&nbsp;they&nbsp;are&nbsp;more&nbsp;interested&nbsp;in&nbsp;application&nbsp;errors.<br>
You&nbsp;could,&nbsp;however,&nbsp;replace&nbsp;this&nbsp;with&nbsp;a&nbsp;custom&nbsp;handler&nbsp;if&nbsp;you&nbsp;wish.<br>
The&nbsp;record&nbsp;which&nbsp;was&nbsp;being&nbsp;processed&nbsp;is&nbsp;passed&nbsp;in&nbsp;to&nbsp;this&nbsp;method.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-release"><strong>release</strong></a>(self)</dt><dd><tt>Release&nbsp;the&nbsp;I/O&nbsp;thread&nbsp;lock.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-setFormatter"><strong>setFormatter</strong></a>(self, fmt)</dt><dd><tt>Set&nbsp;the&nbsp;formatter&nbsp;for&nbsp;this&nbsp;handler.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-setLevel"><strong>setLevel</strong></a>(self, level)</dt><dd><tt>Set&nbsp;the&nbsp;logging&nbsp;level&nbsp;of&nbsp;this&nbsp;handler.&nbsp;&nbsp;level&nbsp;must&nbsp;be&nbsp;an&nbsp;int&nbsp;or&nbsp;a&nbsp;str.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-set_name"><strong>set_name</strong></a>(self, name)</dt></dl>
<hr>
Data descriptors inherited from <a href="logging.html#Handler">logging.Handler</a>:<br>
<dl><dt><strong>name</strong></dt>
</dl>
<hr>
Methods inherited from <a href="logging.html#Filterer">logging.Filterer</a>:<br>
<dl><dt><a name="PyLinkChannelLogger-addFilter"><strong>addFilter</strong></a>(self, filter)</dt><dd><tt>Add&nbsp;the&nbsp;specified&nbsp;filter&nbsp;to&nbsp;this&nbsp;handler.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-filter"><strong>filter</strong></a>(self, record)</dt><dd><tt>Determine&nbsp;if&nbsp;a&nbsp;record&nbsp;is&nbsp;loggable&nbsp;by&nbsp;consulting&nbsp;all&nbsp;the&nbsp;filters.<br>
&nbsp;<br>
The&nbsp;default&nbsp;is&nbsp;to&nbsp;allow&nbsp;the&nbsp;record&nbsp;to&nbsp;be&nbsp;logged;&nbsp;any&nbsp;filter&nbsp;can&nbsp;veto<br>
this&nbsp;and&nbsp;the&nbsp;record&nbsp;is&nbsp;then&nbsp;dropped.&nbsp;Returns&nbsp;a&nbsp;zero&nbsp;value&nbsp;if&nbsp;a&nbsp;record<br>
is&nbsp;to&nbsp;be&nbsp;dropped,&nbsp;else&nbsp;non-zero.<br>
&nbsp;<br>
..&nbsp;versionchanged:&nbsp;3.2<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;Allow&nbsp;filters&nbsp;to&nbsp;be&nbsp;just&nbsp;callables.</tt></dd></dl>
<dl><dt><a name="PyLinkChannelLogger-removeFilter"><strong>removeFilter</strong></a>(self, filter)</dt><dd><tt>Remove&nbsp;the&nbsp;specified&nbsp;filter&nbsp;from&nbsp;this&nbsp;handler.</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="logging.html#Filterer">logging.Filterer</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-makeFileLogger"><strong>makeFileLogger</strong></a>(filename, level=None)</dt><dd><tt>Initializes&nbsp;a&nbsp;file&nbsp;logging&nbsp;target&nbsp;with&nbsp;the&nbsp;given&nbsp;filename&nbsp;and&nbsp;level.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>conf</strong> = {'bot': {'nick': 'PyLink', 'realname': 'PyLink Service Client', 'serverdesc': 'PyLink unit tests', 'user': 'pylink'}, 'logging': {'stdout': 'CRITICAL'}, 'servers': defaultdict(&lt;function &lt;lambda&gt; at 0x7f81857da950&gt;, {})}<br>
<strong>confname</strong> = 'testconf'<br>
<strong>curdir</strong> = '/home/gl/pylink'<br>
<strong>files</strong> = None<br>
<strong>log</strong> = &lt;logging.RootLogger object&gt;<br>
<strong>logdir</strong> = '/home/gl/pylink/log'<br>
<strong>logformatter</strong> = &lt;logging.Formatter object&gt;<br>
<strong>stdout_level</strong> = 'CRITICAL'</td></tr></table>
</body></html>