1 // Copyright (C) 1999-2005 Open Source Telecom Corporation.
2 // Copyright (C) 2006-2010 David Sugar, Tycho Softworks.
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 // As a special exception, you may use this file as part of a free software
19 // library without restriction. Specifically, if other files instantiate
20 // templates or use macros or inline functions from this file, or you compile
21 // this file and link it with other files to produce an executable, this
22 // file does not by itself cause the resulting executable to be covered by
23 // the GNU General Public License. This exception does not however
24 // invalidate any other reasons why the executable file might be covered by
25 // the GNU General Public License.
26 //
27 // This exception applies only to the code released under the name GNU
28 // Common C++. If you copy code from other releases into a copy of GNU
29 // Common C++, as the General Public License permits, the exception does
30 // not apply to the code that you add in this way. To avoid misleading
31 // anyone as to the status of such modified files, you must delete
32 // this exception notice from them.
33 //
34 // If you write modifications of your own for GNU Common C++, it is your choice
35 // whether to permit this exception to apply to your modifications.
36 // If you do not wish that, delete this exception notice.
37 //
38
44 #ifndef CCXX_SLOG_H_
45 #define CCXX_SLOG_H_
46
47 #ifndef CCXX_MISSING_H_
49 #endif
50
51 #ifndef CCXX_THREAD_H_
53 #endif
54
55 #ifndef HAVE_SYSLOG_H
56 #include <cstdio>
57 #endif
58
59 #ifdef CCXX_NAMESPACES
60 namespace ost {
61 #endif
62
105 {
106 public:
121 } Class;
122
132 } Level;
133
134 private:
135 #ifndef HAVE_SYSLOG_H
138 #endif
143
144 ThreadImpl *getPriv(void);
145
146 protected:
152 int overflow(int c);
153
154 public:
163
165
166 void close(void);
167
173 void open(
const char *ident,
Class grp = classUser);
174
181 Slog &operator()(
const char *ident,
Class grp = classUser,
182 Level level = levelError);
183
190
194 Slog &operator()(
void);
195
196 #ifdef HAVE_SNPRINTF
197
202 void error(
const char *format, ...);
203
209 void warn(
const char *format, ...);
210
216 void debug(
const char *format, ...);
217
223 void emerg(
const char *format, ...);
224
230 void alert(
const char *format, ...);
231
237 void critical(
const char *format, ...);
238
244 void notice(
const char *format, ...);
245
251 void info(
const char *format, ...);
252 #endif
253
259 {_level = enable;};
260
267 {_clogEnable = f;};
268
271
274
277
280
283
286
289
292
293 };
294
295 //#ifdef CYGWIN_IMPORTS
296 //extern __declspec(dllimport) Slog slog;
297 //#else
299 //#endif
300
301 #ifdef CCXX_NAMESPACES
302 }
303 #endif
304
305 #endif
306
__EXPORT AppLog & debug(AppLog &sl)
Manipulator for debug level.
__EXPORT AppLog & error(AppLog &sl)
Manipulator for error level.
void clogEnable(bool f=true)
Enables or disables the echoing of the messages to clog in addition to the syslog daemon...
__EXPORT AppLog & info(AppLog &sl)
Manipulator for info level.
substitute functions which may be missing in target platform libc.
The Mutex class is used to protect a section of code so that at any given time only a single thread c...
Synchronization and threading services.
__EXPORT AppLog & emerg(AppLog &sl)
Manipulator for emerg level.
__EXPORT AppLog & notice(AppLog &sl)
Manipulator for notice level.
__EXPORT AppLog & alert(AppLog &sl)
Manipulator for alert level.
void level(Level enable)
Sets the logging level.
The slog class is used to stream messages to the system's logging facility (syslogd).
__EXPORT AppLog & warn(AppLog &sl)
Manipulator for warn level.
__EXPORT AppLog & critical(AppLog &sl)
Manipulator for critical level.