Fawkes API  Fawkes Development Version
multi.h
00001 
00002 /***************************************************************************
00003  *  multi.h - Fawkes multi logger
00004  *
00005  *  Created: Mon May 07 16:42:23 2007
00006  *  Copyright  2006-2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __UTILS_LOGGING_MULTI_H_
00025 #define __UTILS_LOGGING_MULTI_H_
00026 
00027 #include <logging/logger.h>
00028 #include <logging/logger_employer.h>
00029 
00030 namespace fawkes {
00031 
00032 
00033 class MultiLoggerData;
00034 
00035  class MultiLogger : public Logger, public LoggerEmployer
00036 {
00037  public:
00038   MultiLogger();
00039   MultiLogger(Logger *logger);
00040   virtual ~MultiLogger();
00041 
00042   void add_logger(Logger *logger);
00043   void remove_logger(Logger *logger);
00044 
00045   virtual void set_loglevel(LogLevel level);
00046 
00047   virtual void log(LogLevel level,
00048                    const char *component, const char *format, ...);
00049   virtual void log_debug(const char *component, const char *format, ...);
00050   virtual void log_info(const char *component, const char *format, ...);
00051   virtual void log_warn(const char *component, const char *format, ...);
00052   virtual void log_error(const char *component, const char *format, ...);
00053 
00054 
00055   virtual void log(LogLevel level, const char *component, Exception &e);
00056   virtual void log_debug(const char *component, Exception &e);
00057   virtual void log_info(const char *component, Exception &e);
00058   virtual void log_warn(const char *component, Exception &e);
00059   virtual void log_error(const char *component, Exception &e);
00060 
00061   virtual void vlog(LogLevel level, const char *component,
00062                     const char *format, va_list va);
00063   virtual void vlog_debug(const char *component, const char *format, va_list va);
00064   virtual void vlog_info(const char *component, const char *format, va_list va);
00065   virtual void vlog_warn(const char *component, const char *format, va_list va);
00066   virtual void vlog_error(const char *component, const char *format, va_list va);
00067 
00068   virtual void tlog(LogLevel level, struct timeval *t,
00069                     const char *component, const char *format, ...);
00070   virtual void tlog_debug(struct timeval *t, const char *component,
00071                           const char *format, ...);
00072   virtual void tlog_info(struct timeval *t, const char *component,
00073                          const char *format, ...);
00074   virtual void tlog_warn(struct timeval *t, const char *component,
00075                          const char *format, ...);
00076   virtual void tlog_error(struct timeval *t, const char *component,
00077                           const char *format, ...);
00078 
00079   virtual void tlog(LogLevel level, struct timeval *t, const char *component, Exception &e);
00080   virtual void tlog_debug(struct timeval *t, const char *component, Exception &e);
00081   virtual void tlog_info(struct timeval *t, const char *component, Exception &e);
00082   virtual void tlog_warn(struct timeval *t, const char *component, Exception &e);
00083   virtual void tlog_error(struct timeval *t, const char *component, Exception &e);
00084 
00085   virtual void vtlog(LogLevel level, struct timeval *t, const char *component,
00086                      const char *format, va_list va);
00087   virtual void vtlog_debug(struct timeval *t, const char *component,
00088                            const char *format, va_list va);
00089   virtual void vtlog_info(struct timeval *t, const char *component,
00090                           const char *format, va_list va);
00091   virtual void vtlog_warn(struct timeval *t, const char *component,
00092                           const char *format, va_list va);
00093   virtual void vtlog_error(struct timeval *t, const char *component,
00094                            const char *format, va_list va);
00095 
00096 
00097  private:
00098   MultiLoggerData *data;
00099 };
00100 
00101 
00102 } // end namespace fawkes
00103 
00104 #endif