source: pacpusframework/trunk/3rd/apache-log4cxx/include/log4cxx/nt/nteventlogappender.h@ 3

Last change on this file since 3 was 2, checked in by sgosseli, 12 years ago

Add 3rd party libraries (log4cxx).

File size: 4.5 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_NT_EVENT_LOG_APPENDER_HEADER_
19#define _LOG4CXX_NT_EVENT_LOG_APPENDER_HEADER_
20
21#include <log4cxx/appenderskeleton.h>
22
23
24namespace log4cxx
25{
26 namespace nt
27 {
28 /**
29 * Appends log events to NT EventLog.
30 */
31 class LOG4CXX_EXPORT NTEventLogAppender : public AppenderSkeleton
32 {
33 public:
34 DECLARE_LOG4CXX_OBJECT(NTEventLogAppender)
35 BEGIN_LOG4CXX_CAST_MAP()
36 LOG4CXX_CAST_ENTRY(NTEventLogAppender)
37 LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
38 END_LOG4CXX_CAST_MAP()
39
40 NTEventLogAppender();
41 NTEventLogAppender(const LogString& server, const LogString& log,
42 const LogString& source, const LayoutPtr& layout);
43
44 virtual ~NTEventLogAppender();
45
46 virtual void activateOptions(log4cxx::helpers::Pool& p);
47 virtual void close();
48 virtual void setOption(const LogString& option, const LogString& value);
49
50 /**
51 * The SocketAppender does not use a layout. Hence, this method
52 * returns <code>false</code>.
53 *
54 */
55 bool requiresLayout() const
56 { return true; }
57
58 void setSource(const LogString& source)
59 { this->source.assign(source); }
60
61 const LogString& getSource() const
62 { return source; }
63
64 void setLog(const LogString& log)
65 { this->log.assign(log); }
66
67 const LogString& getLog() const
68 { return log; }
69
70 void setServer(const LogString& server)
71 { this->server.assign(server); }
72
73 const LogString& getServer() const
74 { return server; }
75
76
77 protected:
78 //
79 // these typedef are proxies for the real Win32 definitions
80 // and need to be cast to the global definitions before
81 // use with a Win32 API call
82 typedef void SID;
83 typedef void* HANDLE;
84
85 virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
86 static unsigned short getEventType(const spi::LoggingEventPtr& event);
87 static unsigned short getEventCategory(const spi::LoggingEventPtr& event);
88 /*
89 * Add this source with appropriate configuration keys to the registry.
90 */
91 void addRegistryInfo();
92
93 // Data
94 LogString server;
95 LogString log;
96 LogString source;
97 HANDLE hEventLog;
98 SID * pCurrentUserSID;
99 static LogString getErrorString(const LogString& function);
100
101 private:
102 NTEventLogAppender(const NTEventLogAppender&);
103 NTEventLogAppender& operator=(const NTEventLogAppender&);
104 }; // class NTEventLogAppender
105
106 LOG4CXX_PTR_DEF(NTEventLogAppender);
107
108 } // namespace nt
109} // namespace log4cxx
110
111#endif //_LOG4CXX_NT_EVENT_LOG_APPENDER_HEADER_
Note: See TracBrowser for help on using the repository browser.