⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classlogger.html

📁 仿真人工智能是指用人工的方法和技术
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Logger class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"><!-- Generated by Doxygen 1.2.12 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>Logger  Class Reference</h1><code>#include &lt;<a class="el" href="Logger_8h-source.html">Logger.h</a>&gt;</code><p>Collaboration diagram for Logger:<p><center><img src="classLogger__coll__graph.gif" border="0" usemap="#Logger__coll__map" alt="Collaboration graph"></center><map name="Logger__coll__map"><area href="classTiming.html" shape="rect" coords="14,14,65,33" alt=""></map><center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classLogger-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a0">Logger</a> (ostream &amp;<a class="el" href="classLogger.html#o6">os</a>=cout, int <a class="el" href="classLogger.html#o2">iMinLogLevel</a>=0, int <a class="el" href="classLogger.html#o3">iMaxLogLevel</a>=0)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a1">log</a> (int iLevel, string str)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a2">log</a> (int i, char *str,...)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a3">logWithTime</a> (int iLevel, char *str,...)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a4">restartTimer</a> ()</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a5">isInLogLevel</a> (int iLevel)</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a6">getMinLogLevel</a> () const</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a7">setMinLogLevel</a> (int iLevel)</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a8">getMaxLogLevel</a> () const</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a9">setMaxLogLevel</a> (int iLevel)</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a10">getExtraLogLevel</a> () const</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a11">setExtraLogLevel</a> (int iLevel)</td></tr><tr><td nowrap align=right valign=top>char *&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a12">getHeader</a> ()</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a13">setHeader</a> (char *str)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a14">setHeader</a> (int i1, int i2)</td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#a15">setOutputStream</a> (ostream &amp;<a class="el" href="classLogger.html#o6">os</a>)</td></tr><tr><td colspan=2><br><h2>Private Attributes</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classTiming.html">Timing</a>&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#o0">timing</a></td></tr><tr><td nowrap align=right valign=top>char&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#o1">buf</a> [MAX_LOG_LINE]</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#o2">iMinLogLevel</a></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#o3">iMaxLogLevel</a></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#o4">iExtraLogLevel</a></td></tr><tr><td nowrap align=right valign=top>char&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#o5">strHeader</a> [MAX_HEADER]</td></tr><tr><td nowrap align=right valign=top>ostream *&nbsp;</td><td valign=bottom><a class="el" href="classLogger.html#o6">os</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>This class makes it possible to log information on different abstraction levels. All messages are passed to the log method 'log' with a level indication. When this level lies in the specified range (iMinLogLevel.. iMaxLogLevel) the message is logged, otherwise it is ignored. This makes it possible to print only the information you are interested in. There is one global Log class which is used by all classes that use the Logger. This instantation of the Logger is located in the file <a class="el" href="Logger_8C.html">Logger.C</a> and is called 'Log'. All classes that want use this Logger should make a reference to it using the line 'extern Logger Log;' and can then use this Logger with the Log.log( ... ) methods. Furthermore the Logger also contains a timer with makes it possible to print the time since the timer has been restarted. <p><p>Definition at line <a class="el" href="Logger_8h-source.html#l00094">94</a> of file <a class="el" href="Logger_8h-source.html">Logger.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2><a name="a0" doxytag="Logger::Logger"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> Logger::Logger </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">ostream &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>o</em> = cout, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>iMin</em> = 0, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>iMax</em> = 0</td>        </tr>        <tr>          <td></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>This is the constructor for the Logger. The output stream, the minimal and maximal log level can all be specified. The timer in this class is also restarted. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>o</em>&nbsp;</td><td>outputstream (file or cout) to which information is printed (default cout) </td></tr><tr><td valign=top><em>iMin</em>&nbsp;</td><td>minimal log level (default 0) </td></tr><tr><td valign=top><em>iMax</em>&nbsp;</td><td>maximal log level (default 0) </td></tr></table></dl><p>Definition at line <a class="el" href="Logger_8C-source.html#l00066">66</a> of file <a class="el" href="Logger_8C-source.html">Logger.C</a>.<p>References <a class="el" href="Logger_8h-source.html#l00099">iMaxLogLevel</a>, <a class="el" href="Logger_8h-source.html#l00098">iMinLogLevel</a>, <a class="el" href="Logger_8h-source.html#l00102">os</a>, <a class="el" href="Logger_8C-source.html#l00310">Timing::restartTime</a>(), <a class="el" href="Logger_8h-source.html#l00101">strHeader</a>, and <a class="el" href="Logger_8h-source.html#l00096">timing</a>.    </td>  </tr></table><hr><h2>Member Function Documentation</h2><a name="a10" doxytag="Logger::getExtraLogLevel"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int Logger::getExtraLogLevel </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap> const</td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the extra log level. Message with a level that are equal to this value are always logged. <dl compact><dt><b>Returns: </b><dd>minimal log level. </dl><p>Definition at line <a class="el" href="Logger_8C-source.html#l00214">214</a> of file <a class="el" href="Logger_8C-source.html">Logger.C</a>.<p>References <a class="el" href="Logger_8h-source.html#l00100">iExtraLogLevel</a>.    </td>  </tr></table><a name="a12" doxytag="Logger::getHeader"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> char * Logger::getHeader </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the current header that is written before the actual text that has to be logged. <dl compact><dt><b>Returns: </b><dd>current header </dl><p>Definition at line <a class="el" href="Logger_8C-source.html#l00234">234</a> of file <a class="el" href="Logger_8C-source.html">Logger.C</a>.<p>References <a class="el" href="Logger_8h-source.html#l00101">strHeader</a>.    </td>  </tr></table><a name="a8" doxytag="Logger::getMaxLogLevel"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int Logger::getMaxLogLevel </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap> const</td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the maximal log level. Message with a level that are higher than this value are ignored when they are logged. <dl compact><dt><b>Returns: </b><dd>minimal log level. </dl><p>Definition at line <a class="el" href="Logger_8C-source.html#l00196">196</a> of file <a class="el" href="Logger_8C-source.html">Logger.C</a>.<p>References <a class="el" href="Logger_8h-source.html#l00099">iMaxLogLevel</a>.<p>Referenced by <a class="el" href="Logger_8C-source.html#l00169">isInLogLevel</a>().    </td>  </tr></table><a name="a6" doxytag="Logger::getMinLogLevel"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int Logger::getMinLogLevel </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap> const</td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns the minimal log level. Message with a level that lies below this value are ignored when they are logged. <dl compact><dt><b>Returns: </b><dd>minimal log level. </dl><p>Definition at line <a class="el" href="Logger_8C-source.html#l00178">178</a> of file <a class="el" href="Logger_8C-source.html">Logger.C</a>.<p>References <a class="el" href="Logger_8h-source.html#l00098">iMinLogLevel</a>.<p>Referenced by <a class="el" href="Logger_8C-source.html#l00169">isInLogLevel</a>().    </td>  </tr></table><a name="a5" doxytag="Logger::isInLogLevel"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> bool Logger::isInLogLevel </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">int&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>iLevel</em>          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>This method returns whether the supplied log level is recorded, thus within the interval [min_log_level..max_log_level] or equal to the extra log level. <dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>iLevel</em>&nbsp;</td><td>log level that should be checked </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>bool indicating whether the supplied log level is logged. </dl><p>Definition at line <a class="el" href="Logger_8C-source.html#l00169">169</a> of file <a class="el" href="Logger_8C-source.html">Logger.C</a>.<p>References <a class="el" href="Logger_8C-source.html#l00196">getMaxLogLevel</a>(), <a class="el" href="Logger_8C-source.html#l00178">getMinLogLevel</a>(), and <a class="el" href="Logger_8h-source.html#l00100">iExtraLogLevel</a>.<p>Referenced by <a class="el" href="Logger_8C-source.html#l00082">log</a>(), and <a class="el" href="Logger_8C-source.html#l00134">logWithTime</a>().    </td>  </tr></table><a name="a2" doxytag="Logger::log"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> bool Logger::log </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>iLevel</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>char *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>str</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>...&nbsp;</td>          <td class="mdname" nowrap>&nbsp;</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>

⌨️ 快捷键说明

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