Fawkes API  Fawkes Development Version
syslog.h
1 
2 /***************************************************************************
3  * syslog.h - Fawkes syslog logger
4  *
5  * Created: Thu Aug 18 16:53:40 2011
6  * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef _UTILS_LOGGING_SYSLOG_H_
25 #define _UTILS_LOGGING_SYSLOG_H_
26 
27 #include <logging/logger.h>
28 
29 #include <ctime>
30 
31 namespace fawkes {
32 
33 class Mutex;
34 
35 class SyslogLogger : public Logger
36 {
37 public:
39  SyslogLogger(const char *ident, LogLevel log_level = LL_DEBUG);
40  virtual ~SyslogLogger();
41 
42  virtual void log_debug(const char *component, const char *format, ...);
43  virtual void log_info(const char *component, const char *format, ...);
44  virtual void log_warn(const char *component, const char *format, ...);
45  virtual void log_error(const char *component, const char *format, ...);
46 
47  virtual void vlog_debug(const char *component, const char *format, va_list va);
48  virtual void vlog_info(const char *component, const char *format, va_list va);
49  virtual void vlog_warn(const char *component, const char *format, va_list va);
50  virtual void vlog_error(const char *component, const char *format, va_list va);
51 
52  virtual void log_debug(const char *component, Exception &e);
53  virtual void log_info(const char *component, Exception &e);
54  virtual void log_warn(const char *component, Exception &e);
55  virtual void log_error(const char *component, Exception &e);
56 
57  virtual void tlog_debug(struct timeval *t, const char *component, const char *format, ...);
58  virtual void tlog_info(struct timeval *t, const char *component, const char *format, ...);
59  virtual void tlog_warn(struct timeval *t, const char *component, const char *format, ...);
60  virtual void tlog_error(struct timeval *t, const char *component, const char *format, ...);
61 
62  virtual void tlog_debug(struct timeval *t, const char *component, Exception &e);
63  virtual void tlog_info(struct timeval *t, const char *component, Exception &e);
64  virtual void tlog_warn(struct timeval *t, const char *component, Exception &e);
65  virtual void tlog_error(struct timeval *t, const char *component, Exception &e);
66 
67  virtual void
68  vtlog_debug(struct timeval *t, const char *component, const char *format, va_list va);
69  virtual void vtlog_info(struct timeval *t, const char *component, const char *format, va_list va);
70  virtual void vtlog_warn(struct timeval *t, const char *component, const char *format, va_list va);
71  virtual void
72  vtlog_error(struct timeval *t, const char *component, const char *format, va_list va);
73 
74 private:
75  struct ::tm *now_s;
76  Mutex * mutex;
77  char * ident_;
78 };
79 
80 } // end namespace fawkes
81 
82 #endif
fawkes::SyslogLogger::vlog_debug
virtual void vlog_debug(const char *component, const char *format, va_list va)
Definition: syslog.cpp:89
fawkes::SyslogLogger::log_error
virtual void log_error(const char *component, const char *format,...)
Definition: syslog.cpp:180
fawkes::Logger::log_level
LogLevel log_level
Minimum log level.
Definition: logger.h:126
fawkes::Mutex
Definition: mutex.h:38
fawkes::SyslogLogger::tlog_debug
virtual void tlog_debug(struct timeval *t, const char *component, const char *format,...)
Definition: syslog.cpp:237
fawkes::SyslogLogger::vtlog_info
virtual void vtlog_info(struct timeval *t, const char *component, const char *format, va_list va)
Definition: syslog.cpp:377
fawkes::Logger::LL_DEBUG
@ LL_DEBUG
debug output, relevant only when tracking down problems
Definition: logger.h:52
fawkes::SyslogLogger::tlog_error
virtual void tlog_error(struct timeval *t, const char *component, const char *format,...)
Definition: syslog.cpp:264
fawkes::SyslogLogger::log_info
virtual void log_info(const char *component, const char *format,...)
Definition: syslog.cpp:162
fawkes::SyslogLogger::log_debug
virtual void log_debug(const char *component, const char *format,...)
Definition: syslog.cpp:153
fawkes::SyslogLogger::vtlog_error
virtual void vtlog_error(struct timeval *t, const char *component, const char *format, va_list va)
Definition: syslog.cpp:425
fawkes
fawkes::SyslogLogger::vlog_warn
virtual void vlog_warn(const char *component, const char *format, va_list va)
Definition: syslog.cpp:121
fawkes::SyslogLogger::log_warn
virtual void log_warn(const char *component, const char *format,...)
Definition: syslog.cpp:171
fawkes::SyslogLogger::vtlog_warn
virtual void vtlog_warn(struct timeval *t, const char *component, const char *format, va_list va)
Definition: syslog.cpp:401
fawkes::SyslogLogger::tlog_info
virtual void tlog_info(struct timeval *t, const char *component, const char *format,...)
Definition: syslog.cpp:246
fawkes::SyslogLogger::vtlog_debug
virtual void vtlog_debug(struct timeval *t, const char *component, const char *format, va_list va)
Definition: syslog.cpp:353
fawkes::SyslogLogger::SyslogLogger
SyslogLogger(LogLevel log_level=LL_DEBUG)
Constructor.
Definition: syslog.cpp:52
fawkes::Logger::LogLevel
LogLevel
Log level.
Definition: logger.h:51
fawkes::SyslogLogger::vlog_info
virtual void vlog_info(const char *component, const char *format, va_list va)
Definition: syslog.cpp:105
fawkes::SyslogLogger::vlog_error
virtual void vlog_error(const char *component, const char *format, va_list va)
Definition: syslog.cpp:137
fawkes::SyslogLogger::~SyslogLogger
virtual ~SyslogLogger()
Destructor.
Definition: syslog.cpp:78
fawkes::SyslogLogger::tlog_warn
virtual void tlog_warn(struct timeval *t, const char *component, const char *format,...)
Definition: syslog.cpp:255
fawkes::Exception
Definition: exception.h:41