Fawkes API  Fawkes Development Version
console.h
1 
2 /***************************************************************************
3  * console.h - Fawkes console logger
4  *
5  * Created: Tue Jan 16 21:06:50 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_CONSOLE_H_
25 #define __UTILS_LOGGING_CONSOLE_H_
26 
27 #include <logging/logger.h>
28 #include <ctime>
29 
30 namespace fawkes {
31 
32 
33 class Mutex;
34 
35 class ConsoleLogger : public Logger
36 {
37  public:
39  virtual ~ConsoleLogger();
40 
41  virtual void log_debug(const char *component, const char *format, ...);
42  virtual void log_info(const char *component, const char *format, ...);
43  virtual void log_warn(const char *component, const char *format, ...);
44  virtual void log_error(const char *component, const char *format, ...);
45 
46  virtual void vlog_debug(const char *component, const char *format, va_list va);
47  virtual void vlog_info(const char *component, const char *format, va_list va);
48  virtual void vlog_warn(const char *component, const char *format, va_list va);
49  virtual void vlog_error(const char *component, const char *format, va_list va);
50 
51  virtual void log_debug(const char *component, Exception &e);
52  virtual void log_info(const char *component, Exception &e);
53  virtual void log_warn(const char *component, Exception &e);
54  virtual void log_error(const char *component, Exception &e);
55 
56  virtual void tlog_debug(struct timeval *t, const char *component, const char *format, ...);
57  virtual void tlog_info(struct timeval *t, const char *component, const char *format, ...);
58  virtual void tlog_warn(struct timeval *t, const char *component, const char *format, ...);
59  virtual void tlog_error(struct timeval *t, const char *component, const char *format, ...);
60 
61  virtual void tlog_debug(struct timeval *t, const char *component, Exception &e);
62  virtual void tlog_info(struct timeval *t, const char *component, Exception &e);
63  virtual void tlog_warn(struct timeval *t, const char *component, Exception &e);
64  virtual void tlog_error(struct timeval *t, const char *component, Exception &e);
65 
66  virtual void vtlog_debug(struct timeval *t, const char *component,
67  const char *format, va_list va);
68  virtual void vtlog_info(struct timeval *t, const char *component,
69  const char *format, va_list va);
70  virtual void vtlog_warn(struct timeval *t, const char *component,
71  const char *format, va_list va);
72  virtual void vtlog_error(struct timeval *t, const char *component,
73  const char *format, va_list va);
74 
75 
76  private:
77  struct ::tm *now_s;
78  Mutex *mutex;
79 };
80 
81 
82 } // end namespace fawkes
83 
84 #endif
LogLevel
Log level.
Definition: logger.h:45
ConsoleLogger(LogLevel log_level=LL_DEBUG)
Constructor.
Definition: console.cpp:50
LogLevel log_level
Minimum log level.
Definition: logger.h:128
virtual void log_warn(const char *component, const char *format,...)
Log warning message.
Definition: console.cpp:155
virtual void vlog_info(const char *component, const char *format, va_list va)
Log informational message.
Definition: console.cpp:84
virtual void tlog_error(struct timeval *t, const char *component, const char *format,...)
Log error message for specific time.
Definition: console.cpp:281
Interface for logging to stderr.
Definition: console.h:35
Fawkes library namespace.
virtual void log_debug(const char *component, const char *format,...)
Log debug message.
Definition: console.cpp:135
virtual void tlog_info(struct timeval *t, const char *component, const char *format,...)
Log informational message for specific time.
Definition: console.cpp:261
virtual void log_error(const char *component, const char *format,...)
Log error message.
Definition: console.cpp:165
virtual void tlog_warn(struct timeval *t, const char *component, const char *format,...)
Log warning message for specific time.
Definition: console.cpp:271
virtual void log_info(const char *component, const char *format,...)
Log informational message.
Definition: console.cpp:145
Base class for exceptions in Fawkes.
Definition: exception.h:36
virtual void tlog_debug(struct timeval *t, const char *component, const char *format,...)
Log debug message for specific time.
Definition: console.cpp:251
virtual void vtlog_debug(struct timeval *t, const char *component, const char *format, va_list va)
Log debug message for specific time.
Definition: console.cpp:361
virtual void vlog_error(const char *component, const char *format, va_list va)
Log error message.
Definition: console.cpp:118
virtual void vtlog_info(struct timeval *t, const char *component, const char *format, va_list va)
Log informational message for specific time.
Definition: console.cpp:376
virtual void vlog_warn(const char *component, const char *format, va_list va)
Log warning message.
Definition: console.cpp:101
debug output, relevant only when tracking down problems
Definition: logger.h:46
virtual ~ConsoleLogger()
Destructor.
Definition: console.cpp:59
virtual void vtlog_error(struct timeval *t, const char *component, const char *format, va_list va)
Log error message for specific time.
Definition: console.cpp:406
virtual void vtlog_warn(struct timeval *t, const char *component, const char *format, va_list va)
Log warning message for specific time.
Definition: console.cpp:391
virtual void vlog_debug(const char *component, const char *format, va_list va)
Log debug message.
Definition: console.cpp:67
Mutex mutual exclusion lock.
Definition: mutex.h:32
Interface for logging.
Definition: logger.h:34