<!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>slog.h Source File</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> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</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">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>slog.h</h1><a href="slog_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// Copyright (C) 1999-2001 Open Source Telecom Corporation.</font> 00002 <font class="comment">// </font> 00003 <font class="comment">// This program is free software; you can redistribute it and/or modify</font> 00004 <font class="comment">// it under the terms of the GNU General Public License as published by</font> 00005 <font class="comment">// the Free Software Foundation; either version 2 of the License, or</font> 00006 <font class="comment">// (at your option) any later version.</font> 00007 <font class="comment">// </font> 00008 <font class="comment">// This program is distributed in the hope that it will be useful,</font> 00009 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00010 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00011 <font class="comment">// GNU General Public License for more details.</font> 00012 <font class="comment">// </font> 00013 <font class="comment">// You should have received a copy of the GNU General Public License</font> 00014 <font class="comment">// along with this program; if not, write to the Free Software </font> 00015 <font class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</font> 00016 <font class="comment">// </font> 00017 <font class="comment">// As a special exception to the GNU General Public License, permission is </font> 00018 <font class="comment">// granted for additional uses of the text contained in its release </font> 00019 <font class="comment">// of Common C++.</font> 00020 <font class="comment">// </font> 00021 <font class="comment">// The exception is that, if you link the Common C++ library with other</font> 00022 <font class="comment">// files to produce an executable, this does not by itself cause the</font> 00023 <font class="comment">// resulting executable to be covered by the GNU General Public License.</font> 00024 <font class="comment">// Your use of that executable is in no way restricted on account of</font> 00025 <font class="comment">// linking the Common C++ library code into it.</font> 00026 <font class="comment">// </font> 00027 <font class="comment">// This exception does not however invalidate any other reasons why</font> 00028 <font class="comment">// the executable file might be covered by the GNU General Public License.</font> 00029 <font class="comment">// </font> 00030 <font class="comment">// This exception applies only to the code released under the </font> 00031 <font class="comment">// name Common C++. If you copy code from other releases into a copy of</font> 00032 <font class="comment">// Common C++, as the General Public License permits, the exception does</font> 00033 <font class="comment">// not apply to the code that you add in this way. To avoid misleading</font> 00034 <font class="comment">// anyone as to the status of such modified files, you must delete</font> 00035 <font class="comment">// this exception notice from them.</font> 00036 <font class="comment">// </font> 00037 <font class="comment">// If you write modifications of your own for Common C++, it is your choice</font> 00038 <font class="comment">// whether to permit this exception to apply to your modifications.</font> 00039 <font class="comment">// If you do not wish that, delete this exception notice. </font> 00040 00041 <font class="preprocessor">#ifndef CCXX_SLOG_H_</font> 00042 <font class="preprocessor"></font><font class="preprocessor">#define CCXX_SLOG_H_</font> 00043 <font class="preprocessor"></font> 00044 <font class="preprocessor">#ifndef CCXX_CONFIG_H_</font> 00045 <font class="preprocessor"></font><font class="preprocessor">#include <cc++/config.h></font> 00046 <font class="preprocessor">#endif</font> 00047 <font class="preprocessor"></font> 00048 <font class="preprocessor">#ifndef CCXX_THREAD_H_</font> 00049 <font class="preprocessor"></font><font class="preprocessor">#include <<a class="code" href="thread_8h.html">cc++/thread.h</a>></font> 00050 <font class="preprocessor">#endif</font> 00051 <font class="preprocessor"></font> 00052 <font class="preprocessor">#include <fstream></font> 00053 <font class="preprocessor">#include <iostream></font> 00054 <font class="preprocessor">#include <strstream></font> 00055 00056 <font class="preprocessor">#ifdef CCXX_NAMESPACES</font> 00057 <font class="preprocessor"></font><font class="keyword">namespace </font>ost { 00058 <font class="preprocessor">#endif</font> 00059 <font class="preprocessor"></font> <a name="l00060"></a><a class="code" href="namespaceost.html#a247">00060</a> <font class="keyword">enum</font> slog_class_t 00061 { 00062 SLOG_SECURITY, 00063 SLOG_AUDIT, 00064 SLOG_DAEMON, 00065 SLOG_USER, 00066 SLOG_DEFAULT, 00067 SLOG_LOCAL0, 00068 SLOG_LOCAL1, 00069 SLOG_LOCAL2, 00070 SLOG_LOCAL3, 00071 SLOG_LOCAL4, 00072 SLOG_LOCAL5, 00073 SLOG_LOCAL6, 00074 SLOG_LOCAL7 00075 }; <a name="l00076"></a><a class="code" href="namespaceost.html#a69">00076</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> slog_class_t slog_class_t; 00077 <a name="l00078"></a><a class="code" href="namespaceost.html#a248">00078</a> <font class="keyword">enum</font> slog_level_t 00079 { 00080 SLOG_EMERGENCY = 1, 00081 SLOG_ALERT, 00082 SLOG_CRITICAL, 00083 SLOG_ERROR, 00084 SLOG_WARNING, 00085 SLOG_NOTICE, 00086 SLOG_INFO, 00087 SLOG_DEBUG 00088 }; <a name="l00089"></a><a class="code" href="namespaceost.html#a70">00089</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> slog_level_t slog_level_t; 00090 00132 <font class="preprocessor">#if defined(STLPORT) || defined(__KCC)</font> 00133 <font class="preprocessor"></font><font class="preprocessor">#define ostream ostream_withassign</font> 00134 <font class="preprocessor"></font><font class="preprocessor">#endif</font> <a name="l00135"></a><a class="code" href="classost_1_1_slog.html">00135</a> <font class="preprocessor"></font><font class="keyword">class </font>CCXX_CLASS_EXPORT Slog : <font class="keyword">public</font> std::streambuf, <font class="keyword">public</font> std::ostream 00136 { 00137 <font class="keyword">private</font>: 00138 <font class="preprocessor">#ifndef HAVE_SYSLOG_H</font> 00139 <font class="preprocessor"></font> Mutex lock; 00140 std::ofstream syslog; 00141 <font class="preprocessor">#endif</font> 00142 <font class="preprocessor"></font> <font class="keywordtype">int</font> priority; 00143 slog_level_t _level; 00144 <font class="keywordtype">bool</font> _enable; 00145 <font class="keywordtype">bool</font> _clogEnable; 00146 00147 <font class="keyword">protected</font>: 00153 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_slog.html#b0">overflow</a>(<font class="keywordtype">int</font> c); 00154 00155 <font class="keyword">public</font>: 00163 <a class="code" href="classost_1_1_slog.html#a0">Slog</a>(<font class="keywordtype">void</font>); 00164 00165 <font class="keyword">virtual</font> <a class="code" href="classost_1_1_slog.html#a1">~Slog</a>(<font class="keywordtype">void</font>); 00166 00167 <font class="keywordtype">void</font> <a class="code" href="classost_1_1_slog.html#a2">close</a>(<font class="keywordtype">void</font>); 00168 00174 <font class="keywordtype">void</font> <a class="code" href="classost_1_1_slog.html#a3">open</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *ident, slog_class_t grp = SLOG_USER); 00175 00182 Slog &<a class="code" href="classost_1_1_slog.html#a6">operator()</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *ident, slog_class_t grp = SLOG_USER, 00183 slog_level_t level = SLOG_ERROR); 00184 00190 Slog &<a class="code" href="classost_1_1_slog.html#a6">operator()</a>(slog_level_t level, slog_class_t = SLOG_DEFAULT); 00191 00195 Slog &<a class="code" href="classost_1_1_slog.html#a6">operator()</a>(<font class="keywordtype">void</font>); 00196 <a name="l00201"></a><a class="code" href="classost_1_1_slog.html#a7">00201</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_slog.html#a7">level</a>(slog_level_t enable)<font class="keyword"></font> 00202 <font class="keyword"> </font>{_level = enable;}; 00203 <a name="l00209"></a><a class="code" href="classost_1_1_slog.html#a8">00209</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_slog.html#a8">clogEnable</a>(<font class="keywordtype">bool</font> f=<font class="keyword">true</font>)<font class="keyword"></font> 00210 <font class="keyword"> </font>{_clogEnable = f;}; 00211 }; 00212 <a name="l00213"></a><a class="code" href="namespaceost.html#a71">00213</a> <font class="keyword">extern</font> Slog slog; 00214 00215 <font class="preprocessor">#ifdef CCXX_NAMESPACES</font> 00216 <font class="preprocessor"></font>}; 00217 <font class="preprocessor">#endif</font> 00218 <font class="preprocessor"></font> 00219 <font class="preprocessor">#endif</font> 00220 <font class="preprocessor"></font> </pre></div><hr><address><small>Generated at Fri Jan 4 18:51:45 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>, © 1997-2001</small></address> </body> </html>