Rudiments
logger.h
1 // Copyright (c) 2002 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 
9 #ifdef RUDIMENTS_NAMESPACE
10 namespace rudiments {
11 #endif
12 
15 class RUDIMENTS_DLLSPEC logdestination {
16  #include <rudiments/private/logdestination.h>
17 };
18 
19 class syslogdestinationprivate;
20 
22 class RUDIMENTS_DLLSPEC syslogdestination : public logdestination {
23  public:
24 
27 
31 
34  syslogdestination &operator=(const syslogdestination &f);
35 
37  virtual ~syslogdestination();
38 
42  void open(const char *ident, int32_t option,
43  int32_t facility, int32_t priority);
44 
46  void close();
47  #include <rudiments/private/syslogdestination.h>
48 };
49 
50 
51 class filedestinationprivate;
52 
54 class RUDIMENTS_DLLSPEC filedestination : public logdestination {
55  public:
56 
59 
63 
66  filedestination &operator=(const filedestination &f);
67 
69  virtual ~filedestination();
70 
72  bool open(const char *filename);
73 
75  void close();
76  #include <rudiments/private/filedestination.h>
77 };
78 
79 
81 class RUDIMENTS_DLLSPEC stdoutdestination : public logdestination {
82  #include <rudiments/private/stdoutdestination.h>
83 };
84 
85 
87 class RUDIMENTS_DLLSPEC stderrdestination : public logdestination {
88  #include <rudiments/private/stderrdestination.h>
89 };
90 
91 
94 
95 class loggerprivate;
96 
106 class RUDIMENTS_DLLSPEC logger {
107  public:
108 
110  logger();
111 
113  ~logger();
114 
117  void addLogDestination(logdestination *logdest);
118 
121  void removeLogDestination(logdestination *logdest);
122 
125  void removeAllLogDestinations();
126 
127 
143  static char *logHeader(const char *name);
144 
145 
148  void write(const char *header, int32_t tabs,
149  const char *string);
150 
153  void write(const char *header, int32_t tabs, char character);
154 
157  void write(const char *header, int32_t tabs, int32_t number);
158 
161  void write(const char *header, int32_t tabs, double number);
162 
163  #include <rudiments/private/logger.h>
164 };
165 
166 #ifdef RUDIMENTS_NAMESPACE
167 }
168 #endif
169 
170 #endif