Rudiments
|
00001 // Copyright (c) 2002 David Muse 00002 // See the COPYING file for more information. 00003 00004 #ifndef RUDIMENTS_LOGGER_H 00005 #define RUDIMENTS_LOGGER_H 00006 00007 #include <rudiments/private/loggerincludes.h> 00008 00009 #ifdef RUDIMENTS_NAMESPACE 00010 namespace rudiments { 00011 #endif 00012 00015 class RUDIMENTS_DLLSPEC logdestination { 00016 #include <rudiments/private/logdestination.h> 00017 }; 00018 00019 class syslogdestinationprivate; 00020 00022 class RUDIMENTS_DLLSPEC syslogdestination : public logdestination { 00023 public: 00024 00026 syslogdestination(); 00027 00030 syslogdestination(const syslogdestination &f); 00031 00034 syslogdestination &operator=(const syslogdestination &f); 00035 00037 virtual ~syslogdestination(); 00038 00042 void open(const char *ident, int32_t option, 00043 int32_t facility, int32_t priority); 00044 00046 void close(); 00047 #include <rudiments/private/syslogdestination.h> 00048 }; 00049 00050 00051 class filedestinationprivate; 00052 00054 class RUDIMENTS_DLLSPEC filedestination : public logdestination { 00055 public: 00056 00058 filedestination(); 00059 00062 filedestination(const filedestination &f); 00063 00066 filedestination &operator=(const filedestination &f); 00067 00069 virtual ~filedestination(); 00070 00072 bool open(const char *filename); 00073 00075 void close(); 00076 #include <rudiments/private/filedestination.h> 00077 }; 00078 00079 00081 class RUDIMENTS_DLLSPEC stdoutdestination : public logdestination { 00082 #include <rudiments/private/stdoutdestination.h> 00083 }; 00084 00085 00087 class RUDIMENTS_DLLSPEC stderrdestination : public logdestination { 00088 #include <rudiments/private/stderrdestination.h> 00089 }; 00090 00091 00092 typedef linkedlist<logdestination *> loggerlist; 00093 typedef linkedlistnode<logdestination *> loggerlistnode; 00094 00095 class loggerprivate; 00096 00106 class RUDIMENTS_DLLSPEC logger { 00107 public: 00108 00110 logger(); 00111 00113 ~logger(); 00114 00117 void addLogDestination(logdestination *logdest); 00118 00121 void removeLogDestination(logdestination *logdest); 00122 00125 void removeAllLogDestinations(); 00126 00127 00143 static char *logHeader(const char *name); 00144 00145 00148 void write(const char *header, int32_t tabs, 00149 const char *string); 00150 00153 void write(const char *header, int32_t tabs, char character); 00154 00157 void write(const char *header, int32_t tabs, int32_t number); 00158 00161 void write(const char *header, int32_t tabs, double number); 00162 00163 #include <rudiments/private/logger.h> 00164 }; 00165 00166 #ifdef RUDIMENTS_NAMESPACE 00167 } 00168 #endif 00169 00170 #endif