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
29#include <cstdarg>
30#include <cstddef>
31
32namespace fawkes {
33
34class MultiLogger;
35class Logger;
36class Mutex;
37
39{
40public:
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
62private:
63 LibLogger(){};
64
65 static MultiLogger *logger;
66 static Mutex * mutex;
67};
68
69} // end namespace fawkes
70
71#endif
Base class for exceptions in Fawkes.
Definition: exception.h:36
Library logger.
Definition: liblogger.h:39
static void remove_logger(Logger *logger)
Remove logger.
Definition: liblogger.cpp:105
static void log_warn(const char *component, const char *format,...)
Log warning message.
Definition: liblogger.cpp:156
static void vlog_error(const char *component, const char *format, va_list va)
Log error message.
Definition: liblogger.cpp:241
static void log_info(const char *component, const char *format,...)
Log informational message.
Definition: liblogger.cpp:138
static void log_error(const char *component, const char *format,...)
Log error message.
Definition: liblogger.cpp:174
static void vlog_debug(const char *component, const char *format, va_list va)
Log debug message.
Definition: liblogger.cpp:193
static void init(MultiLogger *multi_logger=NULL)
Initialize logger.
Definition: liblogger.cpp:60
static void vlog_info(const char *component, const char *format, va_list va)
Log informational message.
Definition: liblogger.cpp:209
static void log_debug(const char *component, const char *format,...)
Log debug message.
Definition: liblogger.cpp:120
static void finalize()
Delete internal logger.
Definition: liblogger.cpp:78
static void add_logger(Logger *logger)
Add logger.
Definition: liblogger.cpp:91
static void vlog_warn(const char *component, const char *format, va_list va)
Log warning message.
Definition: liblogger.cpp:225
Interface for logging.
Definition: logger.h:42
Log through multiple loggers.
Definition: multi.h:35
Mutex mutual exclusion lock.
Definition: mutex.h:33
Fawkes library namespace.