Commit c59d0600 authored by Scott Cantor's avatar Scott Cantor
Browse files

Make EventLogAppender layout-capable.

parent a0eea8ba
......@@ -36,7 +36,7 @@
#endif // done dealing with ERROR #define
#include <log4shib/Portability.hh>
#include <log4shib/AppenderSkeleton.hh>
#include <log4shib/LayoutAppender.hh>
namespace log4shib {
......@@ -49,7 +49,7 @@ namespace log4shib {
* correctly in Event Viewer.<BR>
* <B>NB:</B> This class is only available on Win32 platforms.
**/
class LOG4SHIB_EXPORT NTEventLogAppender : public AppenderSkeleton {
class LOG4SHIB_EXPORT NTEventLogAppender : public LayoutAppender {
public:
/**
......@@ -67,14 +67,6 @@ namespace log4shib {
virtual void close();
/**
* The NTEventLogAppender does its own Layout.
* @returns false
**/
virtual bool requiresLayout() const;
virtual void setLayout(Layout* layout);
protected:
WORD getCategory(Priority::Value priority);
......
......@@ -9,7 +9,7 @@
namespace log4shib {
NTEventLogAppender::NTEventLogAppender(const std::string& name, const std::string& sourceName) :
AppenderSkeleton(name),
LayoutAppender(name),
_strSourceName(sourceName),
_hEventSource(NULL)
{
......@@ -42,17 +42,11 @@ namespace log4shib {
return true;
}
bool NTEventLogAppender::requiresLayout() const {
return false;
}
void NTEventLogAppender::setLayout(Layout* layout) {
return;
}
void NTEventLogAppender::_append(const LoggingEvent& event) {
std::string message(_getLayout().format(event));
const char* ps[1];
ps[0] = event.message.c_str();
ps[0] = message.c_str();
::ReportEvent(_hEventSource, getType(event.priority),
getCategory(event.priority),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment