Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 806b8574900c6f644b03d5eb76e60aef > files > 21

log4c-doc-1.2.4-1.fc18.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>log4c: appender_type_stream2.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">log4c
   &#160;<span id="projectnumber">1.2.4</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_6ba53b81c010ccbbf4e80737d395d27b.html">log4c</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">appender_type_stream2.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Log4c stream2 appender interface.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;log4c/defs.h&gt;</code><br/>
<code>#include &lt;<a class="el" href="appender_8h_source.html">log4c/appender.h</a>&gt;</code><br/>
</div><div class="textblock"><div class="dynheader">
Include dependency graph for appender_type_stream2.h:</div>
<div class="dyncontent">
<div class="center"><img src="appender__type__stream2_8h__incl.png" border="0" usemap="#appender__type__stream2_8h" alt=""/></div>
<map name="appender__type__stream2_8h" id="appender__type__stream2_8h">
<area shape="rect" id="node5" href="appender_8h.html" title="Implement this interface for your own strategies for printing log statements." alt="" coords="97,80,217,107"/><area shape="rect" id="node8" href="layout_8h.html" title="Interface for user specific layout format of log4c_logging_event events." alt="" coords="141,155,243,181"/><area shape="rect" id="node11" href="logging__event_8h.html" title="the internal representation of logging events." alt="" coords="163,229,311,256"/><area shape="rect" id="node14" href="buffer_8h.html" title="log4c buffer" alt="" coords="379,304,480,331"/><area shape="rect" id="node19" href="location__info_8h.html" title="The internal representation of caller location information." alt="" coords="213,304,355,331"/></map>
</div>
</div>
<p><a href="appender__type__stream2_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a03a3eb6fecb20f3485f893d9789c7e18"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="appender__type__stream2_8h.html#a03a3eb6fecb20f3485f893d9789c7e18">log4c_stream2_set_fp</a> (<a class="el" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a> *a_this, FILE *fp)</td></tr>
<tr class="separator:a03a3eb6fecb20f3485f893d9789c7e18"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a944c81b57fbca35471ab3570741157ac"><td class="memItemLeft" align="right" valign="top">FILE *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="appender__type__stream2_8h.html#a944c81b57fbca35471ab3570741157ac">log4c_stream2_get_fp</a> (<a class="el" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a> *a_this)</td></tr>
<tr class="separator:a944c81b57fbca35471ab3570741157ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7efb03da2647f7d0ba898786aff990c3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="appender__type__stream2_8h.html#a7efb03da2647f7d0ba898786aff990c3">log4c_stream2_set_flags</a> (<a class="el" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a> *a_this, int flags)</td></tr>
<tr class="separator:a7efb03da2647f7d0ba898786aff990c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ada52fb4b349407d61da968a7c124891a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="appender__type__stream2_8h.html#ada52fb4b349407d61da968a7c124891a">log4c_stream2_get_flags</a> (<a class="el" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a> *a_this)</td></tr>
<tr class="separator:ada52fb4b349407d61da968a7c124891a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a4fbf7dcd95d9f386aff3120d8c5bd87a"><td class="memItemLeft" align="right" valign="top">__LOG4C_BEGIN_DECLS const <br class="typebreak"/>
<a class="el" href="appender_8h.html#a3b0ea324b72e8122c20c3b237beb923e">log4c_appender_type_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="appender__type__stream2_8h.html#a4fbf7dcd95d9f386aff3120d8c5bd87a">log4c_appender_type_stream2</a></td></tr>
<tr class="separator:a4fbf7dcd95d9f386aff3120d8c5bd87a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Log4c stream2 appender interface. </p>
<p>The stream2 appender uses a file handle <code>FILE*</code> for logging. It can be used with <code>stdout</code>, <code>stderr</code> or a normal file. It is pretty primitive as it does not do file rotation, or have a maximum configurable file size etc. It improves on the stream appender in a few ways that make it a better starting point for new stream based appenders.</p>
<p>It enhances the stream appender by allowing the default file pointer to be used in buffered or unbuffered mode. Also when you set the file pointer stream2 will not attempt to close it on exit which avoids it fighting with the owner of the file pointer. stream2 is configured via setter functions&ndash;the udata is not exposed directly. This means that new options (eg. configure the open mode ) could be added to stream2 while maintaining backward compatability.</p>
<p>The appender can be used with default values, for example as follows:</p>
<div class="fragment"><div class="line"><a class="code" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a>* myappender;</div>
<div class="line"></div>
<div class="line">myappender = log4c_appender_get(<span class="stringliteral">&quot;/var/logs/mylog.log&quot;</span>);</div>
<div class="line">log4c_appender_set_type(myappender,log4c_appender_type_get(<span class="stringliteral">&quot;stream2&quot;</span>));</div>
</div><!-- fragment --><p>In this case the appender will be configured automatically with default values: </p>
<ul>
<li>the filename is the same as the name of the appender, <code>"/var/logs/mymlog.log"</code> </li>
<li>the file is opened in "w+" mode </li>
<li>the default system buffer is used (cf; <code>setbuf()</code> ) in buffered mode</li>
</ul>
<p>The stream2 appender can be configured by passing it a file pointer to use. In this case you manage the file pointer yourself&ndash;open, option setting, closing. If you set the file pointer log4c will not close the file on exiting&ndash;you must do this:</p>
<div class="fragment"><div class="line"><a class="code" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a>* myappender;</div>
<div class="line">FILE * fp = fopen(<span class="stringliteral">&quot;myfile.log&quot;</span>, <span class="stringliteral">&quot;w&quot;</span>);</div>
<div class="line"></div>
<div class="line">myappender = log4c_appender_get(<span class="stringliteral">&quot;myappender&quot;</span>);</div>
<div class="line">log4c_appender_set_type(myappender, log4c_appender_type_get(<span class="stringliteral">&quot;stream2&quot;</span>));</div>
<div class="line">log4c_stream2_set_fp(stream2_appender,myfp);</div>
</div><!-- fragment --><p>The default file pointer can be configured to use unbuffered mode. Buffered mode is typically 25%-50% faster than unbuffered mode but unbuffered mode is useful if your preference is for a more synchronized log file:</p>
<div class="fragment"><div class="line"> <a class="code" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a>* myappender;</div>
<div class="line"></div>
<div class="line">myappender = log4c_appender_get(<span class="stringliteral">&quot;/var/logs/mylog.log&quot;</span>);</div>
<div class="line">log4c_appender_set_type(myappender,log4c_appender_type_get(<span class="stringliteral">&quot;stream2&quot;</span>));</div>
<div class="line">log4c_stream2_set_flags(myappender, LOG4C_STREAM2_UNBUFFERED);</div>
</div><!-- fragment --> </div><h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ada52fb4b349407d61da968a7c124891a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int log4c_stream2_get_flags </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a> *&#160;</td>
          <td class="paramname"><em>a_this</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the flags for this appender. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">this</td><td>a pointer to the appender </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the flags for this appender. returns -1 if there was a problem. </dd></dl>

</div>
</div>
<a class="anchor" id="a944c81b57fbca35471ab3570741157ac"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">FILE* log4c_stream2_get_fp </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a> *&#160;</td>
          <td class="paramname"><em>a_this</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the file pointer for this appender. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">this</td><td>a pointer to the appender </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the file pointer for this appender. If there's a problem returns NULL. </dd></dl>

</div>
</div>
<a class="anchor" id="a7efb03da2647f7d0ba898786aff990c3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void log4c_stream2_set_flags </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a> *&#160;</td>
          <td class="paramname"><em>a_this</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set the flags for this appender. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">this</td><td>a pointer to the appender </td></tr>
    <tr><td class="paramname">flags</td><td>ar teh flags to set. These will overwrite the existing flags. Currently supported flags: LOG4C_STREAM2_UNBUFFERED </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a03a3eb6fecb20f3485f893d9789c7e18"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void log4c_stream2_set_fp </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="appender_8h.html#ab9a6df639c26566a4576233dfcc21b55">log4c_appender_t</a> *&#160;</td>
          <td class="paramname"><em>a_this</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>fp</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set the file pointer for this appender. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">this</td><td>a pointer to the appender </td></tr>
    <tr><td class="paramname">fp</td><td>the file pointer this appender will use. The caller is responsible for managing the file pointer (open, option setting, closing). </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="a4fbf7dcd95d9f386aff3120d8c5bd87a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">__LOG4C_BEGIN_DECLS const <a class="el" href="appender_8h.html#a3b0ea324b72e8122c20c3b237beb923e">log4c_appender_type_t</a> log4c_appender_type_stream2</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Stream2 appender type definition.</p>
<p>This should be used as a parameter to the <a class="el" href="appender_8h.html#a5749474749c8b3ec049acb82add2501f">log4c_appender_set_type()</a> routine to set the type of the appender. </p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3.1
</small></address>
</body>
</html>