NTEventLogAppender.hh
Go to the documentation of this file.
1 /*
2  * NTEventLogAppender.hh
3  *
4  * See the COPYING file for the terms of usage and distribution.
5  */
6 
7 #ifndef _LOG4CPP_NTEVENTLOGAPPENDER_HH
8 #define _LOG4CPP_NTEVENTLOGAPPENDER_HH
9 
10 #ifdef _WIN32 // only available on Win32
11 
12 // deal with ERROR #define
13 // N.B. This #includes windows.h with NOGDI and WIN32_LEAN_AND_MEAN #defined.
14 // If this is not what the user wants, #include windows.h before this file.
15 #ifndef _WINDOWS_
16 # ifndef NOGDI
17 # define NOGDI // this will circumvent the ERROR #define in windows.h
18 # define LOG4CPP_UNDEFINE_NOGDI
19 # endif
20 
21 # ifndef WIN32_LEAN_AND_MEAN
22 # define WIN32_LEAN_AND_MEAN
23 # define LOG4CPP_UNDEFINE_WIN32_LEAN_AND_MEAN
24 # endif
25 
26 # include <windows.h>
27 
28 # ifdef LOG4CPP_UNDEFINE_NOGDI
29 # undef NOGDI
30 # endif
31 
32 # ifdef LOG4CPP_UNDEFINE_WIN32_LEAN_AND_MEAN
33 # undef WIN32_LEAN_AND_MEAN
34 # endif
35 
36 #endif // done dealing with ERROR #define
37 
38 #include <log4cpp/Portability.hh>
40 
42 
52 class LOG4CPP_EXPORT NTEventLogAppender : public AppenderSkeleton {
53 public:
54 
60  NTEventLogAppender(const std::string& name, const std::string& sourceName);
61  virtual ~NTEventLogAppender();
62 
66  virtual bool reopen();
67 
68  virtual void close();
69 
74  virtual bool requiresLayout() const;
75 
76  virtual void setLayout(Layout* layout);
77 
78 protected:
79 
80  WORD getCategory(Priority::Value priority);
81  WORD getType(Priority::Value priority);
82  HKEY regGetKey(TCHAR *subkey, DWORD *disposition);
83  void regSetString(HKEY hkey, TCHAR *name, TCHAR *value);
84  void regSetDword(HKEY hkey, TCHAR *name, DWORD value);
85  void addRegistryInfo(const char *source);
86 
87  virtual void open();
88 
93  virtual void _append(const LoggingEvent& event);
94 
95  HANDLE _hEventSource;
96  std::string _strSourceName;
97 };
99 
100 #else // WIN32
101 #error NTEventLoggAppender is not available on on Win32 platforms
102 #endif // WIN32
103 
104 #endif // _LOG4CPP_NTEVENTLOGAPPENDER_HH
105 
#define LOG4CPP_NS_END
Definition: Portability.hh:50
virtual bool reopen()
Reopens the output destination of this Appender, e.g.
The top level namespace for all &#39;Log for C++&#39; types and classes.
Definition: LoggingEvent.hh:32
virtual void _append(const LoggingEvent &event)=0
Log in Appender specific way.
virtual bool requiresLayout() const =0
Check if the appender uses a layout.
virtual void setLayout(Layout *layout)=0
Set the Layout for this appender.
virtual void close()=0
Release any resources allocated within the appender such as file handles, network connections...
#define LOG4CPP_EXPORT
Definition: Export.hh:21
AppenderSkeleton is a helper class, simplifying implementation of Appenders: it already takes care of...
Extend this abstract class to create your own log layout format.
Definition: Layout.hh:22
int Value
The type of Priority Values.
Definition: Priority.hh:87
#define LOG4CPP_NS_BEGIN
Definition: Portability.hh:49


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 19:10:54