classlog4cpp_1_1fixedcontextcategory.html

来自「log4cpp 的参考文档, 一个非常好用的C++ log 类库」· HTML 代码 · 共 708 行 · 第 1/3 页

HTML
708
字号
<!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::FixedContextCategory 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&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div><div class="nav"><a class="el" href="namespacelog4cpp.html">log4cpp</a>::<a class="el" href="classlog4cpp_1_1FixedContextCategory.html">FixedContextCategory</a></div><h1>log4cpp::FixedContextCategory Class Reference</h1>This <a class="el" href="classlog4cpp_1_1Category.html">Category</a> subclass replaces the <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> field in LoggingEvents with a fixed context string.  <a href="#_details">More...</a><p><code>#include &lt;<a class="el" href="FixedContextCategory_8hh-source.html">FixedContextCategory.hh</a>&gt;</code><p>Inheritance diagram for log4cpp::FixedContextCategory:<p><center><img src="classlog4cpp_1_1FixedContextCategory__inherit__graph.png" border="0" usemap="#log4cpp_1_1FixedContextCategory__inherit__map" alt="Inheritance graph"></center><map name="log4cpp_1_1FixedContextCategory__inherit__map"><area href="classlog4cpp_1_1Category.html" shape="rect" coords="46,9,177,33" alt=""></map><center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for log4cpp::FixedContextCategory:<p><center><img src="classlog4cpp_1_1FixedContextCategory__coll__graph.png" border="0" usemap="#log4cpp_1_1FixedContextCategory__coll__map" alt="Collaboration graph"></center><map name="log4cpp_1_1FixedContextCategory__coll__map"><area href="classlog4cpp_1_1Category.html" shape="rect" coords="46,9,177,33" alt=""></map><center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classlog4cpp_1_1FixedContextCategory-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 Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a0">FixedContextCategory</a> (const std::string &amp;name, const std::string &amp;context="")</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor.  <a href="#a0"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a1">~FixedContextCategory</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor for <a class="el" href="classlog4cpp_1_1Category.html">Category</a>.  <a href="#a1"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a2">setContext</a> (const std::string &amp;context)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the context string used as <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a>.  <a href="#a2"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual std::string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a3">getContext</a> () const </td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the context string used as <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a>.  <a href="#a3"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a4">getPriority</a> () const   throw ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the assigned <a class="el" href="classlog4cpp_1_1Priority.html">Priority</a>, if any, for this <a class="el" href="classlog4cpp_1_1Category.html">Category</a>.  <a href="#a4"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a5">getChainedPriority</a> () const   throw ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Starting from this <a class="el" href="classlog4cpp_1_1Category.html">Category</a>, search the category hierarchy for a set priority and return it.  <a href="#a5"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a6">addAppender</a> (<a class="el" href="classlog4cpp_1_1Appender.html">Appender</a> *appender)  throw ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">For the moment this method does nothing.  <a href="#a6"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a7">addAppender</a> (<a class="el" href="classlog4cpp_1_1Appender.html">Appender</a> &amp;appender)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">For the moment this method does nothing.  <a href="#a7"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classlog4cpp_1_1Appender.html">Appender</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a8">getAppender</a> () const </td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the <a class="el" href="classlog4cpp_1_1Appender.html">Appender</a> for this <a class="el" href="classlog4cpp_1_1Category.html">Category</a>, or NULL if no <a class="el" href="classlog4cpp_1_1Appender.html">Appender</a> has been set.  <a href="#a8"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classlog4cpp_1_1Appender.html">Appender</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a9">getAppender</a> (const std::string &amp;name) const </td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the specified <a class="el" href="classlog4cpp_1_1Appender.html">Appender</a> for this <a class="el" href="classlog4cpp_1_1Category.html">Category</a>, or NULL if the <a class="el" href="classlog4cpp_1_1Appender.html">Appender</a> is not attached to this <a class="el" href="classlog4cpp_1_1Category.html">Category</a>.  <a href="#a9"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="namespacelog4cpp.html#a1">AppenderSet</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a10">getAllAppenders</a> () const </td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the set of Appenders currently attached to this Catogory.  <a href="#a10"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a11">removeAllAppenders</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Removes all appenders set for this <a class="el" href="classlog4cpp_1_1Category.html">Category</a>.  <a href="#a11"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a12">ownsAppender</a> () const   throw ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">FixedContextAppenders cannot own Appenders.  <a href="#a12"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a13">ownsAppender</a> (<a class="el" href="classlog4cpp_1_1Appender.html">Appender</a> *appender) const   throw ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">FixedContextAppenders cannot own Appenders.  <a href="#a13"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a14">callAppenders</a> (const <a class="el" href="structlog4cpp_1_1LoggingEvent.html">LoggingEvent</a> &amp;event)  throw ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Call the appenders in the hierarchy starting at <code>this</code>.  <a href="#a14"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a15">setAdditivity</a> (bool additivity)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the additivity flag for this <a class="el" href="classlog4cpp_1_1Category.html">Category</a> instance.  <a href="#a15"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#a16">getAdditivity</a> () const   throw ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the additivity flag for this <a class="el" href="classlog4cpp_1_1Category.html">Category</a> instance.  <a href="#a16"></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 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1FixedContextCategory.html#b0">_logUnconditionally2</a> (<a class="el" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> priority, const std::string &amp;message)  throw ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unconditionally log a message with the specified priority.  <a href="#b0"></a><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>This <a class="el" href="classlog4cpp_1_1Category.html">Category</a> subclass replaces the <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> field in LoggingEvents with a fixed context string. <p>All handling of Appenders, etc. is delgated to the 'normal' <a class="el" href="classlog4cpp_1_1Category.html">Category</a> with the same name. Its intended use is for object instances that serve a single client: they contruct a <a class="el" href="classlog4cpp_1_1FixedContextCategory.html">FixedContextCategory</a> with the client identifier as context. Unlike with regular <a class="el" href="classlog4cpp_1_1Category.html">Category</a> instances one has to explicitly create <a class="el" href="classlog4cpp_1_1FixedContextCategory.html">FixedContextCategory</a> instances using the constructor. This also implies one has to take cake of destruction of the instance as well. <dl compact><dt><b>Since:</b></dt><dd>0.2.4 </dd></dl><p><hr><h2>Constructor &amp; Destructor Documentation</h2><a class="anchor" name="a0" doxytag="log4cpp::FixedContextCategory::FixedContextCategory"></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::FixedContextCategory::FixedContextCategory           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>          <td class="mdname" nowrap> <em>name</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap>const std::string &amp;&nbsp;</td>          <td class="mdname" nowrap> <em>context</em> = <code>""</code></td>        </tr>        <tr>          <td class="md"></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Constructor. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>the fully qualified name of this Categories delegate <a class="el" href="classlog4cpp_1_1Category.html">Category</a>. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>context</em>&nbsp;</td><td>the context to fill the <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> field of LoggingEvents with. </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a1" doxytag="log4cpp::FixedContextCategory::~FixedContextCategory"></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::FixedContextCategory::~FixedContextCategory           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Destructor for <a class="el" href="classlog4cpp_1_1Category.html">Category</a>. <p>    </td>  </tr></table><hr><h2>Member Function Documentation</h2><a class="anchor" name="b0" doxytag="log4cpp::FixedContextCategory::_logUnconditionally2"></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">void log4cpp::FixedContextCategory::_logUnconditionally2           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a>&nbsp;</td>          <td class="mdname" nowrap> <em>priority</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap>const std::string &amp;&nbsp;</td>          <td class="mdname" nowrap> <em>message</em></td>        </tr>        <tr>          <td class="md"></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2">  throw ()<code> [protected, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Unconditionally log a message with the specified priority. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>priority</em>&nbsp;</td><td>The priority of this log message. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>message</em>&nbsp;</td><td>string to write in the log file </td></tr>  </table></dl><p>Reimplemented from <a class="el" href="classlog4cpp_1_1Category.html#b2">log4cpp::Category</a>.    </td>  </tr></table><a class="anchor" name="a7" doxytag="log4cpp::FixedContextCategory::addAppender"></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">void log4cpp::FixedContextCategory::addAppender           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="classlog4cpp_1_1Appender.html">Appender</a> &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>appender</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>For the moment this method does nothing. 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?