00001
00002
00003
00004
00005
00006
00007 #ifndef _LOG4CPP_NTEVENTLOGAPPENDER_HH
00008 #define _LOG4CPP_NTEVENTLOGAPPENDER_HH
00009
00010 #ifdef WIN32 // only available on Win32
00011
00012 #include <log4cpp/Portability.hh>
00013 #include <log4cpp/AppenderSkeleton.hh>
00014
00015 namespace log4cpp {
00016
00026 class LOG4CPP_EXPORT NTEventLogAppender : public AppenderSkeleton {
00027 public:
00028
00034 NTEventLogAppender(const std::string& name, const std::string& sourceName);
00035 virtual ~NTEventLogAppender();
00036
00040 virtual bool reopen();
00041
00042 virtual void close();
00043
00048 virtual bool requiresLayout() const;
00049
00050 virtual void setLayout(Layout* layout);
00051
00052 protected:
00053
00054 WORD getCategory(Priority::Value priority);
00055 WORD getType(Priority::Value priority);
00056 HKEY regGetKey(TCHAR *subkey, DWORD *disposition);
00057 void regSetString(HKEY hkey, TCHAR *name, TCHAR *value);
00058 void regSetDword(HKEY hkey, TCHAR *name, DWORD value);
00059 void addRegistryInfo(const char *source);
00060
00061 virtual void open();
00062
00067 virtual void _append(const LoggingEvent& event);
00068
00069 HANDLE _hEventSource;
00070 std::string _strSourceName;
00071 };
00072 }
00073
00074 #else // WIN32
00075 #error NTEventLoggAppender is not available on on Win32 platforms
00076 #endif // WIN32
00077
00078 #endif // _LOG4CPP_NTEVENTLOGAPPENDER_HH
00079