Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 68d373e54fb21da3730c08bede406633 > files > 630

libCommonC++1.9_3-devel-1.9.4-2mdk.i586.rpm

<!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>ost::Slog class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.2.10 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</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="namespacemembers.html">Namespace Members</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>ost::Slog  Class Reference</h1>The slog class is used to stream messages to the system's logging facility (syslogd). system logging facility class. 
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="slog_8h-source.html">slog.h</a>&gt;</code>
<p>
<p>Inheritance diagram for ost::Slog::
<p><center><img src="classost_1_1_slog.gif" usemap="#ost::Slog_map" border="0"></center>
<map name="ost::Slog_map">
<area href="classstd_1_1streambuf.html" alt="std::streambuf" shape="rect" coords="0,0,89,24">
<area href="classstd_1_1ostream.html" alt="std::ostream" shape="rect" coords="99,0,188,24">
</map>
<a href="classost_1_1_slog-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="classost_1_1_slog.html#a0">Slog</a> (void)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Default (and only) constructor.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>virtual&nbsp;</td><td valign=bottom><a class="el" href="classost_1_1_slog.html#a1">~Slog</a> (void)</td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classost_1_1_slog.html#a2">close</a> (void)</td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classost_1_1_slog.html#a3">open</a> (const char *ident, <a class="el" href="namespaceost.html#a69">slog_class_t</a> grp=SLOG_USER)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>(re)opens the output stream.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>Slog &amp;&nbsp;</td><td valign=bottom><a class="el" href="classost_1_1_slog.html#a4">operator()</a> (const char *ident, <a class="el" href="namespaceost.html#a69">slog_class_t</a> grp=SLOG_USER, <a class="el" href="namespaceost.html#a70">slog_level_t</a> level=SLOG_ERROR)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Sets the log identifier, level, and class to use for subsequent output.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>Slog &amp;&nbsp;</td><td valign=bottom><a class="el" href="classost_1_1_slog.html#a5">operator()</a> (<a class="el" href="namespaceost.html#a70">slog_level_t</a> level, <a class="el" href="namespaceost.html#a69">slog_class_t</a>=SLOG_DEFAULT)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Changes the log level and class to use for subsequent output.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>Slog &amp;&nbsp;</td><td valign=bottom><a class="el" href="classost_1_1_slog.html#a6">operator()</a> (void)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Does nothing except return *this.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classost_1_1_slog.html#a7">level</a> (<a class="el" href="namespaceost.html#a70">slog_level_t</a> enable)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Sets the logging level.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classost_1_1_slog.html#a8">clogEnable</a> (bool f=true)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Enables or disables the echoing of the messages to clog in addition to the syslog daemon.</em> <a href="#a8">More...</a><em></em></font><br><br></td></tr>
<tr><td colspan=2><br><h2>Protected Methods</h2></td></tr>
<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classost_1_1_slog.html#b0">overflow</a> (int c)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>This is the streambuf function that actually outputs the data to the device.</em> <a href="#b0">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The slog class is used to stream messages to the system's logging facility (syslogd). system logging facility class.
<p>
A default <code>slog</code> object is used to avoid confusion with the native syslog facility and to imply a logical relationship to the C++ <code>clog()</code>.
<p>
The key difference is that the <code>slog</code> object sends it's output to the system logging daemon (typically syslogd) rather than through stderr. <code>slog</code> can be streamed with the <code>&lt;&lt;</code> operator just  like <code>clog</code>; a default slog object is pre-initialized, and you stream character data to it.
<p>
The <code>slog</code> allows one to specify logging levels and other properties through the <code>()</code> operators. Hence, once can do:
<p>
<code><pre>
 slog("mydaemon", SLOG_DAEMON, SLOG_EMERGENCY) &lt;&lt; I just died &lt;&lt; endl; </pre></code>
<p>
or things like:
<p>
<code><pre>
 slog("mydaemon", SLOG_DAEMON); 
 slog(SLOG_INFO) &lt;&lt; "daemon initalized" &lt;&lt; endl; </pre></code>
<p>
The intent is to be as common-place and as convenient to use as the stderr based clog facility found in C++, and this is especially useful for C++ daemons.
<p>
The <code>std::flush</code> manipulator doesn't work. Either the <code>std::endl</code> or <code>std::ends</code> manipulators must be used to cause the output to be sent to the daemon.
<p>
When this class is used on a system that doesn't have the syslog headers (i.e. a non-posix win32 box), the output goes to the a file with the same name as the syslog identifier string with '.log' appended to it. If the identifier string ends in '.exe', the '.exe' is removed before the '.log' is appened. (e.g. the identifier foo.exe will generate a log file named foo.log)
<p>
<dl compact><dt><b>
Author: </b><dd>
David Sugar &lt;<a href="mailto:dyfet@ostel.com">dyfet@ostel.com</a>&gt; <br>
Minor docs &amp; hacks by Jon Little &lt;<a href="mailto:littlej@arlut.utexas.edu">littlej@arlut.utexas.edu</a>&gt; </dl>
<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a name="a0" doxytag="ost::Slog::Slog"></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"> ost::Slog::Slog </td>
          <td class="md">(&nbsp;</td>
          <td class="md">void</td>
          <td class="mdname1">&nbsp;          </td>
          <td class="md">)&nbsp;</td>
          <td class="md"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Default (and only) constructor.
<p>
The default log level is set to SLOG_DEBUG. There is no default log facility set. One should be set before attempting any output. This is done by the <code><a class="el" href="classost_1_1_slog.html#a3">open</a>()</code> or the <code><a class="el" href="classost_1_1_slog.html#a4">operator()</a>(const char *, slog_class_t, slog_level_t)</code> functions.     </td>
  </tr>
</table>
<a name="a1" doxytag="ost::Slog::~Slog"></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"> virtual ost::Slog::~Slog </td>
          <td class="md">(&nbsp;</td>
          <td class="md">void</td>
          <td class="mdname1">&nbsp;          </td>
          <td class="md">)&nbsp;</td>
          <td class="md"><code> [virtual]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a name="a8" doxytag="ost::Slog::clogEnable"></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"> void ost::Slog::clogEnable </td>
          <td class="md">(&nbsp;</td>
          <td class="md">bool</td>
          <td class="mdname1">&nbsp; <em>f</em> = true          </td>
          <td class="md">)&nbsp;</td>
          <td class="md"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Enables or disables the echoing of the messages to clog in addition to the syslog daemon.
<p>
This is enabled by the default class constructor. <dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>f
</em>&nbsp;</td><td>
true to enable, false to disable clog output </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a2" doxytag="ost::Slog::close"></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"> void ost::Slog::close </td>
          <td class="md">(&nbsp;</td>
          <td class="md">void</td>
          <td class="mdname1">&nbsp;          </td>
          <td class="md">)&nbsp;</td>
          <td class="md"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a name="a7" doxytag="ost::Slog::level"></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"> void ost::Slog::level </td>
          <td class="md">(&nbsp;</td>
          <td class="md"><a class="el" href="namespaceost.html#a70">slog_level_t</a></td>
          <td class="mdname1">&nbsp; <em>enable</em>          </td>
          <td class="md">)&nbsp;</td>
          <td class="md"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Sets the logging level.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>enable
</em>&nbsp;</td><td>
is the logging level to use for further output </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a3" doxytag="ost::Slog::open"></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"> void ost::Slog::open </td>
          <td class="md">(&nbsp;</td>
          <td class="md">const char *</td>
          <td class="mdname">&nbsp; <em>ident</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md"><a class="el" href="namespaceost.html#a69">slog_class_t</a></td>
          <td class="mdname">&nbsp; <em>grp</em> = SLOG_USER</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>
(re)opens the output stream.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>ident
</em>&nbsp;</td><td>
The identifier portion of the message sent to the syslog daemon. </td></tr>
<tr><td valign=top><em>grp
</em>&nbsp;</td><td>
The log facility the message is sent to </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a6" doxytag="ost::Slog::operator()"></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"> Slog&amp; ost::Slog::operator() </td>
          <td class="md">(&nbsp;</td>
          <td class="md">void</td>
          <td class="mdname1">&nbsp;          </td>
          <td class="md">)&nbsp;</td>
          <td class="md"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Does nothing except return *this.
<p>
    </td>
  </tr>
</table>
<a name="a5" doxytag="ost::Slog::operator()"></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"> Slog&amp; ost::Slog::operator() </td>
          <td class="md">(&nbsp;</td>
          <td class="md"><a class="el" href="namespaceost.html#a70">slog_level_t</a></td>
          <td class="mdname">&nbsp; <em>level</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md"><a class="el" href="namespaceost.html#a69">slog_class_t</a></td>
          <td class="mdname">&nbsp; = SLOG_DEFAULT</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>
Changes the log level and class to use for subsequent output.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>level
</em>&nbsp;</td><td>
The log level of the message </td></tr>
<tr><td valign=top><em>grp
</em>&nbsp;</td><td>
The log facility the message is sent to </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a4" doxytag="ost::Slog::operator()"></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"> Slog&amp; ost::Slog::operator() </td>
          <td class="md">(&nbsp;</td>
          <td class="md">const char *</td>
          <td class="mdname">&nbsp; <em>ident</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md"><a class="el" href="namespaceost.html#a69">slog_class_t</a></td>
          <td class="mdname">&nbsp; <em>grp</em> = SLOG_USER, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md"><a class="el" href="namespaceost.html#a70">slog_level_t</a></td>
          <td class="mdname">&nbsp; <em>level</em> = SLOG_ERROR</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>
Sets the log identifier, level, and class to use for subsequent output.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>ident
</em>&nbsp;</td><td>
The identifier portion of the message </td></tr>
<tr><td valign=top><em>grp
</em>&nbsp;</td><td>
The log facility the message is sent to </td></tr>
<tr><td valign=top><em>level
</em>&nbsp;</td><td>
The log level of the message </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="b0" doxytag="ost::Slog::overflow"></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 ost::Slog::overflow </td>
          <td class="md">(&nbsp;</td>
          <td class="md">int</td>
          <td class="mdname1">&nbsp; <em>c</em>          </td>
          <td class="md">)&nbsp;</td>
          <td class="md"><code> [protected]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
This is the streambuf function that actually outputs the data to the device.
<p>
Since all output should be done with the standard ostream operators, this function should never be called directly.     </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="slog_8h-source.html">slog.h</a></ul>
<hr><address><small>Generated at Fri Jan 4 18:51:50 2002 for CommonC++ by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.gif" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
 &copy;&nbsp;1997-2001</small></address>
</body>
</html>