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 
21 
25 
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 
51 
55 
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 
87 
97 class RUDIMENTS_DLLSPEC logger {
98  public:
99 
102 
105 
109 
113 
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
Definition: logger.h:46
filedestination & operator=(const filedestination &f)
filedestination(const filedestination &f)
virtual ~filedestination()
bool open(const char *filename, mode_t perms)
Definition: linkedlist.h:60
Definition: linkedlist.h:11
Definition: logger.h:11
Definition: logger.h:97
void removeAllLogDestinations()
void setIndent(char ch)
void addLogDestination(logdestination *logdest)
static char * logHeader(const char *name)
void end(uint8_t level, const char *header, uint32_t indent)
void write(uint8_t level, const char *header, uint32_t indent, const char *format, va_list *argp)
uint8_t getLogLevel()
void setLogLevel(uint8_t level)
void removeLogDestination(logdestination *logdest)
char getIndent()
void start(uint8_t level, const char *header, uint32_t indent, const char *string)
void write(uint8_t level, const char *header, uint32_t indent, const char *format,...)
Definition: logger.h:80
Definition: logger.h:74
Definition: logger.h:16
void open(const char *ident, int32_t option, int32_t facility, int32_t priority)
syslogdestination & operator=(const syslogdestination &f)
syslogdestination(const syslogdestination &f)
virtual ~syslogdestination()