Rudiments: /home/dmuse/temp/rudiments/include/rudiments/logger.h Source File

Rudiments

logger.h
1 // Copyright (c) 1999-2018 David Muse
2 // See the COPYING file for more information.
3
4 #ifndef RUDIMENTS_LOGGER_H
5 #define RUDIMENTS_LOGGER_H
6
7 #include <rudiments/private/loggerincludes.h>
8
11 class RUDIMENTS_DLLSPEC logdestination {
12 #include <rudiments/private/logdestination.h>
13 };
14
16 class RUDIMENTS_DLLSPEC syslogdestination : public logdestination {
17 public:
18
20 syslogdestination();
21
24 syslogdestination(const syslogdestination &f);
25
28 syslogdestination &operator=(const syslogdestination &f);
29
31 virtual ~syslogdestination();
32
36 void open(const char *ident, int32_t option,
37 int32_t facility, int32_t priority);
38
40 void close();
41 #include <rudiments/private/syslogdestination.h>
42 };
43
44
46 class RUDIMENTS_DLLSPEC filedestination : public logdestination {
47 public:
48
50 filedestination();
51
54 filedestination(const filedestination &f);
55
58 filedestination &operator=(const filedestination &f);
59
61 virtual ~filedestination();
62
65 bool open(const char *filename, mode_t perms);
66
68 void close();
69 #include <rudiments/private/filedestination.h>
70 };
71
72
74 class RUDIMENTS_DLLSPEC stdoutdestination : public logdestination {
75 #include <rudiments/private/stdoutdestination.h>
76 };
77
78
80 class RUDIMENTS_DLLSPEC stderrdestination : public logdestination {
81 #include <rudiments/private/stderrdestination.h>
82 };
83
84
85 typedef linkedlistnode<logdestination *> loggerlistnode;
86 typedef linkedlist<logdestination *> loggerlist;
87
97 class RUDIMENTS_DLLSPEC logger {
98 public:
99
101 logger();
102
104 ~logger();
105
108 void addLogDestination(logdestination *logdest);
109
112 void removeLogDestination(logdestination *logdest);
113
116 void removeAllLogDestinations();
117
118
120 void setIndent(char ch);
121
123 char getIndent();
124
125
127 void setLogLevel(uint8_t level);
128
130 uint8_t getLogLevel();
131
132
148 static char *logHeader(const char *name);
149
150
155 void start(uint8_t level,
156 const char *header,
157 uint32_t indent,
158 const char *string);
159
164 void write(uint8_t level,
165 const char *header,
166 uint32_t indent,
167 const char *format, ...);
168
173 void write(uint8_t level,
174 const char *header,
175 uint32_t indent,
176 const char *format,
177 va_list *argp);
178
182 void end(uint8_t level,
183 const char *header,
184 uint32_t indent);
185
186 #include <rudiments/private/logger.h>
187 };
188
189 #endif
filedestination
Definition: logger.h:46
filedestination::operator=
filedestination & operator=(const filedestination &f)
filedestination::close
void close()
filedestination::filedestination
filedestination(const filedestination &f)
filedestination::~filedestination
virtual ~filedestination()
filedestination::filedestination
filedestination()
filedestination::open
bool open(const char *filename, mode_t perms)
linkedlist
Definition: linkedlist.h:60
linkedlistnode
Definition: linkedlist.h:11
logdestination
Definition: logger.h:11
logger
Definition: logger.h:97
logger::removeAllLogDestinations
void removeAllLogDestinations()
logger::logger
logger()
logger::setIndent
void setIndent(char ch)
logger::addLogDestination
void addLogDestination(logdestination *logdest)
logger::logHeader
static char * logHeader(const char *name)
logger::end
void end(uint8_t level, const char *header, uint32_t indent)
logger::write
void write(uint8_t level, const char *header, uint32_t indent, const char *format, va_list *argp)
logger::getLogLevel
uint8_t getLogLevel()
logger::setLogLevel
void setLogLevel(uint8_t level)
logger::~logger
~logger()
logger::removeLogDestination
void removeLogDestination(logdestination *logdest)
logger::getIndent
char getIndent()
logger::start
void start(uint8_t level, const char *header, uint32_t indent, const char *string)
logger::write
void write(uint8_t level, const char *header, uint32_t indent, const char *format,...)
stderrdestination
Definition: logger.h:80
stdoutdestination
Definition: logger.h:74
syslogdestination
Definition: logger.h:16
syslogdestination::open
void open(const char *ident, int32_t option, int32_t facility, int32_t priority)
syslogdestination::close
void close()
syslogdestination::operator=
syslogdestination & operator=(const syslogdestination &f)
syslogdestination::syslogdestination
syslogdestination(const syslogdestination &f)
syslogdestination::syslogdestination
syslogdestination()
syslogdestination::~syslogdestination
virtual ~syslogdestination()