API Documentation
00001 // Module: Log4CPLUS 00002 // File: nteventlogappender.h 00003 // Created: 4/2003 00004 // Author: Michael CATANZARITI 00005 // 00006 // Copyright (C) Michael CATANZARITI All rights reserved. 00007 // 00008 // This software is published under the terms of the Apache Software 00009 // License version 1.1, a copy of which has been included with this 00010 // distribution in the LICENSE.APL file. 00011 // 00012 00015 #ifndef _LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_ 00016 #define _LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_ 00017 00018 #include <log4cplus/config.h> 00019 #if defined(_WIN32) 00020 00021 #include <log4cplus/appender.h> 00022 00023 00024 namespace log4cplus { 00025 00029 class LOG4CPLUS_EXPORT NTEventLogAppender : public Appender { 00030 public: 00031 // ctors 00032 NTEventLogAppender(const log4cplus::tstring& server, 00033 const log4cplus::tstring& log, 00034 const log4cplus::tstring& source); 00035 NTEventLogAppender(const log4cplus::helpers::Properties properties); 00036 00037 // dtor 00038 virtual ~NTEventLogAppender(); 00039 00040 // public Methods 00041 virtual void close(); 00042 00043 protected: 00044 virtual void append(const spi::InternalLoggingEvent& event); 00045 virtual WORD getEventType(const spi::InternalLoggingEvent& event); 00046 virtual WORD getEventCategory(const spi::InternalLoggingEvent& event); 00047 void init(); 00048 00049 /* 00050 * Add this source with appropriate configuration keys to the registry. 00051 */ 00052 void addRegistryInfo(); 00053 00054 // Data 00055 log4cplus::tstring server; 00056 log4cplus::tstring log; 00057 log4cplus::tstring source; 00058 HANDLE hEventLog; 00059 SID* pCurrentUserSID; 00060 00061 private: 00062 // Disallow copying of instances of this class 00063 NTEventLogAppender(const NTEventLogAppender&); 00064 NTEventLogAppender& operator=(const NTEventLogAppender&); 00065 }; 00066 00067 } // end namespace log4cplus 00068 00069 #endif // _WIN32 00070 #endif //_LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_ 00071