📄 classlog4cpp_1_1filter.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>log4cpp: log4cpp::Filter Class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.2 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div><div class="nav"><a class="el" href="namespacelog4cpp.html">log4cpp</a>::<a class="el" href="classlog4cpp_1_1Filter.html">Filter</a></div><h1>log4cpp::Filter Class Reference</h1>Users should extend this class to implement customized logging event filtering. <a href="#_details">More...</a><p><code>#include <<a class="el" href="Filter_8hh-source.html">Filter.hh</a>></code><p>Collaboration diagram for log4cpp::Filter:<p><center><img src="classlog4cpp_1_1Filter__coll__graph.png" border="0" usemap="#log4cpp_1_1Filter__coll__map" alt="Collaboration graph"></center><center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classlog4cpp_1_1Filter-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Public Types</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1Filter.html#w3">Decision</a> { <a class="el" href="classlog4cpp_1_1Filter.html#w3w0">DENY</a> = -1, <a class="el" href="classlog4cpp_1_1Filter.html#w3w1">NEUTRAL</a> = 0, <a class="el" href="classlog4cpp_1_1Filter.html#w3w2">ACCEPT</a> = 1 }</td></tr><tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1Filter.html#a0">Filter</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Default Constructor for <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a>. <a href="#a0"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1Filter.html#a1">~Filter</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor for <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a>. <a href="#a1"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1Filter.html#a2">setChainedFilter</a> (<a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> *filter)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Set the next <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> in the <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> chain. <a href="#a2"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1Filter.html#a3">getChainedFilter</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get the next <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> in the <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> chain. <a href="#a3"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1Filter.html#a4">getEndOfChain</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Get the last <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> in the <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> chain. <a href="#a4"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1Filter.html#a5">appendChainedFilter</a> (<a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> *filter)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Add a <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> to the end of the <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> chain. <a href="#a5"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classlog4cpp_1_1Filter.html#w3">Decision</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1Filter.html#a6">decide</a> (const <a class="el" href="structlog4cpp_1_1LoggingEvent.html">LoggingEvent</a> &event)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Decide whether to accept or deny a <a class="el" href="structlog4cpp_1_1LoggingEvent.html">LoggingEvent</a>. <a href="#a6"></a><br></td></tr><tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classlog4cpp_1_1Filter.html#w3">Decision</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1Filter.html#b0">_decide</a> (const <a class="el" href="structlog4cpp_1_1LoggingEvent.html">LoggingEvent</a> &event)=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Decide whether <b>this</b> <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> accepts or denies the given <a class="el" href="structlog4cpp_1_1LoggingEvent.html">LoggingEvent</a>. <a href="#b0"></a><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Users should extend this class to implement customized logging event filtering. <p>Note that <a class="el" href="classlog4cpp_1_1Category.html">log4cpp::Category</a> and lof4cpp::Appender have built-in filtering rules. It is suggested that you first use and understand the built-in rules before rushing to write your own custom filters.<p>This abstract class assumes and also imposes that filters be organized in a linear chain. The <code>decide(LoggingEvent)</code> method of each filter is called sequentially, in the order of their addition to the chain.<p>The <code>decide(LoggingEvent)</code> method must return a Decision value, either DENY, NEUTRAL or ACCCEPT.<p>If the value DENY is returned, then the log event is dropped immediately without consulting with the remaining filters.<p>If the value NEUTRAL is returned, then the next filter in the chain is consulted. If there are no more filters in the chain, then the log event is logged. Thus, in the presence of no filters, the default behaviour is to log all logging events.<p>If the value ACCEPT is returned, then the log event is logged without consulting the remaining filters.<p>The philosophy of <a class="el" href="namespacelog4cpp.html">log4cpp</a> filters is largely inspired from the Linux ipchains. <p><hr><h2>Member Enumeration Documentation</h2><a class="anchor" name="w3" doxytag="log4cpp::Filter::Decision"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">enum <a class="el" href="classlog4cpp_1_1Filter.html#w3">log4cpp::Filter::Decision</a> </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em><a class="anchor" name="w3w0" doxytag="DENY"></a>DENY</em> </td><td></td></tr><tr><td valign="top"><em><a class="anchor" name="w3w1" doxytag="NEUTRAL"></a>NEUTRAL</em> </td><td></td></tr><tr><td valign="top"><em><a class="anchor" name="w3w2" doxytag="ACCEPT"></a>ACCEPT</em> </td><td></td></tr></table></dl> </td> </tr></table><hr><h2>Constructor & Destructor Documentation</h2><a class="anchor" name="a0" doxytag="log4cpp::Filter::Filter"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">log4cpp::Filter::Filter </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Default Constructor for <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a>. <p> </td> </tr></table><a class="anchor" name="a1" doxytag="log4cpp::Filter::~Filter"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">log4cpp::Filter::~Filter </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Destructor for <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a>. <p> </td> </tr></table><hr><h2>Member Function Documentation</h2><a class="anchor" name="b0" doxytag="log4cpp::Filter::_decide"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">virtual <a class="el" href="classlog4cpp_1_1Filter.html#w3">Decision</a> log4cpp::Filter::_decide </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const <a class="el" href="structlog4cpp_1_1LoggingEvent.html">LoggingEvent</a> & </td> <td class="mdname1" valign="top" nowrap> <em>event</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [protected, pure virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Decide whether <b>this</b> <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> accepts or denies the given <a class="el" href="structlog4cpp_1_1LoggingEvent.html">LoggingEvent</a>. <p>Actual implementation of <a class="el" href="classlog4cpp_1_1Filter.html">Filter</a> should override this method and not <code>decide(LoggingEvent&)</code>. <dl compact><dt><b>Parameters:</b></dt><dd>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -