Fawkes API  Fawkes Development Version
multi.h
1 
2 /***************************************************************************
3  * multi.h - Fawkes multi logger
4  *
5  * Created: Mon May 07 16:42:23 2007
6  * Copyright 2006-2007 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_MULTI_H_
25 #define __UTILS_LOGGING_MULTI_H_
26 
27 #include <logging/logger.h>
28 #include <logging/logger_employer.h>
29 
30 namespace fawkes {
31 
32 
33 class MultiLoggerData;
34 
35  class MultiLogger : public Logger, public LoggerEmployer
36 {
37  public:
38  MultiLogger();
39  MultiLogger(Logger *logger);
40  virtual ~MultiLogger();
41 
42  void add_logger(Logger *logger);
43  void remove_logger(Logger *logger);
44 
45  virtual void set_loglevel(LogLevel level);
46 
47  virtual void log(LogLevel level,
48  const char *component, const char *format, ...);
49  virtual void log_debug(const char *component, const char *format, ...);
50  virtual void log_info(const char *component, const char *format, ...);
51  virtual void log_warn(const char *component, const char *format, ...);
52  virtual void log_error(const char *component, const char *format, ...);
53 
54 
55  virtual void log(LogLevel level, const char *component, Exception &e);
56  virtual void log_debug(const char *component, Exception &e);
57  virtual void log_info(const char *component, Exception &e);
58  virtual void log_warn(const char *component, Exception &e);
59  virtual void log_error(const char *component, Exception &e);
60 
61  virtual void vlog(LogLevel level, const char *component,
62  const char *format, va_list va);
63  virtual void vlog_debug(const char *component, const char *format, va_list va);
64  virtual void vlog_info(const char *component, const char *format, va_list va);
65  virtual void vlog_warn(const char *component, const char *format, va_list va);
66  virtual void vlog_error(const char *component, const char *format, va_list va);
67 
68  virtual void tlog(LogLevel level, struct timeval *t,
69  const char *component, const char *format, ...);
70  virtual void tlog_debug(struct timeval *t, const char *component,
71  const char *format, ...);
72  virtual void tlog_info(struct timeval *t, const char *component,
73  const char *format, ...);
74  virtual void tlog_warn(struct timeval *t, const char *component,
75  const char *format, ...);
76  virtual void tlog_error(struct timeval *t, const char *component,
77  const char *format, ...);
78 
79  virtual void tlog(LogLevel level, struct timeval *t, const char *component, Exception &e);
80  virtual void tlog_debug(struct timeval *t, const char *component, Exception &e);
81  virtual void tlog_info(struct timeval *t, const char *component, Exception &e);
82  virtual void tlog_warn(struct timeval *t, const char *component, Exception &e);
83  virtual void tlog_error(struct timeval *t, const char *component, Exception &e);
84 
85  virtual void vtlog(LogLevel level, struct timeval *t, const char *component,
86  const char *format, va_list va);
87  virtual void vtlog_debug(struct timeval *t, const char *component,
88  const char *format, va_list va);
89  virtual void vtlog_info(struct timeval *t, const char *component,
90  const char *format, va_list va);
91  virtual void vtlog_warn(struct timeval *t, const char *component,
92  const char *format, va_list va);
93  virtual void vtlog_error(struct timeval *t, const char *component,
94  const char *format, va_list va);
95 
96 
97  private:
98  MultiLoggerData *data;
99 };
100 
101 
102 } // end namespace fawkes
103 
104 #endif
LogLevel
Log level.
Definition: logger.h:45
virtual void vtlog_debug(struct timeval *t, const char *component, const char *format, va_list va)
Log debug message for specific time.
Definition: multi.cpp:629
virtual void log_error(const char *component, const char *format,...)
Log error message.
Definition: multi.cpp:249
Fawkes library namespace.
virtual void tlog_error(struct timeval *t, const char *component, const char *format,...)
Log error message for specific time.
Definition: multi.cpp:525
virtual void tlog_warn(struct timeval *t, const char *component, const char *format,...)
Log warning message for specific time.
Definition: multi.cpp:505
virtual void tlog(LogLevel level, struct timeval *t, const char *component, const char *format,...)
Log message of given log level and time.
Definition: multi.cpp:446
Logger employer The LoggerEmployer shall pipe all log messages of the system to added loggers...
virtual void vtlog_error(struct timeval *t, const char *component, const char *format, va_list va)
Log error message for specific time.
Definition: multi.cpp:680
virtual void tlog_info(struct timeval *t, const char *component, const char *format,...)
Log informational message for specific time.
Definition: multi.cpp:485
virtual void vtlog_info(struct timeval *t, const char *component, const char *format, va_list va)
Log informational message for specific time.
Definition: multi.cpp:646
virtual ~MultiLogger()
Destructor.
Definition: multi.cpp:99
Log through multiple loggers.
Definition: multi.h:35
virtual void tlog_debug(struct timeval *t, const char *component, const char *format,...)
Log debug message for specific time.
Definition: multi.cpp:466
virtual void set_loglevel(LogLevel level)
Sets the log level.
Definition: multi.cpp:146
Base class for exceptions in Fawkes.
Definition: exception.h:36
virtual void vlog_error(const char *component, const char *format, va_list va)
Log error message.
Definition: multi.cpp:428
virtual void vtlog(LogLevel level, struct timeval *t, const char *component, const char *format, va_list va)
Log message for given log level and time.
Definition: multi.cpp:611
virtual void vlog_debug(const char *component, const char *format, va_list va)
Log debug message.
Definition: multi.cpp:371
MultiLogger()
Constructor.
Definition: multi.cpp:79
virtual void log(LogLevel level, const char *component, const char *format,...)
Log message of given log level.
Definition: multi.cpp:161
virtual void log_warn(const char *component, const char *format,...)
Log warning message.
Definition: multi.cpp:227
virtual void vlog_info(const char *component, const char *format, va_list va)
Log informational message.
Definition: multi.cpp:390
void add_logger(Logger *logger)
Add a logger.
Definition: multi.cpp:115
virtual void vtlog_warn(struct timeval *t, const char *component, const char *format, va_list va)
Log warning message for specific time.
Definition: multi.cpp:663
virtual void vlog_warn(const char *component, const char *format, va_list va)
Log warning message.
Definition: multi.cpp:409
virtual void log_info(const char *component, const char *format,...)
Log informational message.
Definition: multi.cpp:205
virtual void vlog(LogLevel level, const char *component, const char *format, va_list va)
Log message for given log level.
Definition: multi.cpp:351
virtual void log_debug(const char *component, const char *format,...)
Log debug message.
Definition: multi.cpp:183
void remove_logger(Logger *logger)
Remove logger.
Definition: multi.cpp:134
Interface for logging.
Definition: logger.h:34