Go to the documentation of this file.
44 #ifndef COMMONCPP_SLOG_H_
45 #define COMMONCPP_SLOG_H_
49 #ifndef COMMONCPP_CONFIG_H_
50 #include <commoncpp/config.h>
53 #ifndef COMMONCPP_STRING_H_
57 #ifndef COMMONCPP_THREAD_H_
104 class __EXPORT
Slog :
protected std::streambuf,
public std::ostream
135 mutable pthread_mutex_t lock;
171 void open(
const char *ident, Class grp = classUser);
180 Level level = levelError);
199 void error(
const char *format, ...);
206 void warn(
const char *format, ...);
213 void debug(
const char *format, ...);
220 void emerg(
const char *format, ...);
227 void alert(
const char *format, ...);
248 void info(
const char *format, ...);
268 return operator()(Slog::levelWarning);
271 inline Slog &error(
void) {
272 return operator()(Slog::levelError);
275 inline Slog &
debug(
void) {
276 return operator()(Slog::levelDebug);
279 inline Slog &
emerg(
void) {
280 return operator()(Slog::levelEmergency);
283 inline Slog &
alert(
void) {
284 return operator()(Slog::levelAlert);
288 return operator()(Slog::levelCritical);
291 inline Slog &
notice(
void) {
292 return operator()(Slog::levelNotice);
295 inline Slog &
info(
void) {
296 return operator()(Slog::levelInfo);
301 extern __EXPORT Slog slog;
void clogEnable(bool f=true)
Enables or disables the echoing of the messages to clog in addition to the syslog daemon.
Slog & operator()(void)
Does nothing except return *this.
The slog class is used to stream messages to the system's logging facility (syslogd).
AppLog & notice(AppLog &sl)
Manipulator for notice level.
Common C++ thread class and sychronization objects.
Slog & operator()(Level level, Class grp=classDefault)
Changes the log level and class to use for subsequent output.
void debug(const char *format,...)
Print a formatted syslog string.
Slog(void)
Default (and only) constructor.
Slog & operator()(const char *ident, Class grp=classUser, Level level=levelError)
Sets the log identifier, level, and class to use for subsequent output.
int overflow(int c)
This is the streambuf function that actually outputs the data to the device.
void error(const char *format,...)
Print a formatted syslog string.
AppLog & debug(AppLog &sl)
Manipulator for debug level.
void alert(const char *format,...)
Print a formatted syslog string.
AppLog & warn(AppLog &sl)
Manipulator for warn level.
Common C++ generic string class.
AppLog & emerg(AppLog &sl)
Manipulator for emerg level.
void notice(const char *format,...)
Print a formatted syslog string.
void level(Level enable)
Sets the logging level.
AppLog & alert(AppLog &sl)
Manipulator for alert level.
void info(const char *format,...)
Print a formatted syslog string.
void critical(const char *format,...)
Print a formatted syslog string.
AppLog & info(AppLog &sl)
Manipulator for info level.
void open(const char *ident, Class grp=classUser)
(re)opens the output stream.
void warn(const char *format,...)
Print a formatted syslog string.
void emerg(const char *format,...)
Print a formatted syslog string.
AppLog & critical(AppLog &sl)
Manipulator for critical level.