libtrbase  1.0.2
Web server and task management solution.
logger.h
Go to the documentation of this file.
1 /**
2  * \file
3  * A generic logger class and two extended classes, One that logs to
4  * stderr and one that logs to the system syslog.
5  *
6  * \author Georg Hopp
7  *
8  * \copyright
9  * Copyright © 2014 Georg Hopp
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
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 General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef __TR_LOGGER_H__
26 #define __TR_LOGGER_H__
27 
28 #include "trbase.h"
29 
30 typedef enum {
40 
41 #include "tr/interface/logger.h"
42 
43 extern const char * const TR_logger_level_str[];
44 
45 TR_CLASS(TR_Logger) {
46  TR_logger_level min_level;
47 };
48 
49 TR_CLASS(TR_LoggerStderr) {
50  TR_EXTENDS(TR_Logger);
51 };
52 
53 TR_CLASS(TR_LoggerSyslog) {
54  TR_EXTENDS(TR_Logger);
55 };
56 
57 TR_INSTANCE_INIT(TR_Logger);
58 TR_INSTANCE_INIT(TR_LoggerStderr);
59 TR_INSTANCE_INIT(TR_LoggerSyslog);
60 
61 TR_CLASSVARS_DECL(TR_Logger) {};
62 TR_CLASSVARS_DECL(TR_LoggerStderr) {};
63 TR_CLASSVARS_DECL(TR_LoggerSyslog) {};
64 
65 extern TR_Logger TR_logger;
66 
67 #endif // __TR_LOGGER_H__
68 
69 // vim: set ts=4 sw=4:
TR_logger_level
Definition: logger.h:30
TR_CLASS(TR_Logger)
Definition: logger.h:45
const char *const TR_logger_level_str[]
Definition: logger.c:31
#define TR_EXTENDS(parent)
Definition: class.h:96
TR_Logger TR_logger
Definition: stderr.c:41
TR_CLASSVARS_DECL(TR_Logger)
Definition: logger.h:61
TR_INSTANCE_INIT(TR_Logger)