log4cplus  2.1.0
nteventlogappender.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Module: Log4CPLUS
3 // File: nteventlogappender.h
4 // Created: 4/2003
5 // Author: Michael CATANZARITI
6 //
7 // Copyright 2003-2017 Michael CATANZARITI
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 
23 #ifndef LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_
24 #define LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_
25 
26 #include <log4cplus/config.hxx>
27 
28 #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
29 #pragma once
30 #endif
31 
32 #if defined (LOG4CPLUS_HAVE_NT_EVENT_LOG)
33 
34 #include <log4cplus/appender.h>
36 
37 
38 namespace log4cplus {
39 
44  public:
45  // ctors
47  const log4cplus::tstring& log,
48  const log4cplus::tstring& source);
50 
51  // dtor
53 
54  // public Methods
55  virtual void close();
56 
57  protected:
58  virtual void append(const spi::InternalLoggingEvent& event);
59  virtual WORD getEventType(const spi::InternalLoggingEvent& event);
60  virtual WORD getEventCategory(const spi::InternalLoggingEvent& event);
61  void init();
62 
63  /*
64  * Add this source with appropriate configuration keys to the registry.
65  */
67 
68  // Data
72  HANDLE hEventLog;
74 
75  private:
76  // Disallow copying of instances of this class
78  NTEventLogAppender& operator=(const NTEventLogAppender&);
79  };
80 
81 } // end namespace log4cplus
82 
83 #endif // LOG4CPLUS_HAVE_NT_EVENT_LOG
84 #endif //LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_
Extend this class for implementing your own strategies for printing log statements.
Definition: appender.h:139
Appends log events to NT EventLog.
NTEventLogAppender(const log4cplus::tstring &server, const log4cplus::tstring &log, const log4cplus::tstring &source)
virtual void close()
Release any resources allocated within the appender such as file handles, network connections,...
virtual WORD getEventCategory(const spi::InternalLoggingEvent &event)
NTEventLogAppender(const log4cplus::helpers::Properties &properties)
virtual void append(const spi::InternalLoggingEvent &event)
Subclasses of Appender should implement this method to perform actual logging.
virtual WORD getEventType(const spi::InternalLoggingEvent &event)
The internal representation of logging events.
Definition: loggingevent.h:51
std::basic_string< tchar > tstring
Definition: tstring.h:39
#define LOG4CPLUS_EXPORT
Definition: win32.h:141