Fawkes API  Fawkes Development Version
liblogger.h
1 
2 /***************************************************************************
3  * liblogger.h - Fawkes lib logger
4  *
5  * Created: Mon May 07 15:19:34 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_LIBLOGGER_H_
25 #define __UTILS_LOGGING_LIBLOGGER_H_
26 
27 #include <core/exception.h>
28 #include <cstdarg>
29 #include <cstddef>
30 
31 namespace fawkes {
32 
33 
34 class MultiLogger;
35 class Logger;
36 class Mutex;
37 
38 class LibLogger
39 {
40  public:
41  static void init(MultiLogger *multi_logger = NULL);
42  static void finalize();
43 
44  static void add_logger(Logger *logger);
45  static void remove_logger(Logger *logger);
46 
47  static void log_debug(const char *component, const char *format, ...);
48  static void log_info(const char *component, const char *format, ...);
49  static void log_warn(const char *component, const char *format, ...);
50  static void log_error(const char *component, const char *format, ...);
51 
52  static void vlog_debug(const char *component, const char *format, va_list va);
53  static void vlog_info(const char *component, const char *format, va_list va);
54  static void vlog_warn(const char *component, const char *format, va_list va);
55  static void vlog_error(const char *component, const char *format, va_list va);
56 
57  static void log_debug(const char *component, Exception &e);
58  static void log_info(const char *component, Exception &e);
59  static void log_warn(const char *component, Exception &e);
60  static void log_error(const char *component, Exception &e);
61 
62  private:
63  LibLogger(){};
64 
65  static MultiLogger *logger;
66  static Mutex *mutex;
67 };
68 
69 
70 } // end namespace fawkes
71 
72 #endif
static void finalize()
Delete internal logger.
Definition: liblogger.cpp:83
static void log_info(const char *component, const char *format,...)
Log informational message.
Definition: liblogger.cpp:144
static void log_debug(const char *component, const char *format,...)
Log debug message.
Definition: liblogger.cpp:126
Library logger.
Definition: liblogger.h:38
Fawkes library namespace.
static void vlog_warn(const char *component, const char *format, va_list va)
Log warning message.
Definition: liblogger.cpp:231
static void vlog_info(const char *component, const char *format, va_list va)
Log informational message.
Definition: liblogger.cpp:215
static void vlog_debug(const char *component, const char *format, va_list va)
Log debug message.
Definition: liblogger.cpp:199
Log through multiple loggers.
Definition: multi.h:35
static void log_error(const char *component, const char *format,...)
Log error message.
Definition: liblogger.cpp:180
static void vlog_error(const char *component, const char *format, va_list va)
Log error message.
Definition: liblogger.cpp:247
Base class for exceptions in Fawkes.
Definition: exception.h:36
static void log_warn(const char *component, const char *format,...)
Log warning message.
Definition: liblogger.cpp:162
static void init(MultiLogger *multi_logger=NULL)
Initialize logger.
Definition: liblogger.cpp:63
static void add_logger(Logger *logger)
Add logger.
Definition: liblogger.cpp:97
static void remove_logger(Logger *logger)
Remove logger.
Definition: liblogger.cpp:111
Mutex mutual exclusion lock.
Definition: mutex.h:32
Interface for logging.
Definition: logger.h:34