Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifdef WIN32 // only available on Win32
00010
00011 #include "PortabilityImpl.hh"
00012 #ifdef LOG4CPP_HAVE_IO_H
00013 # include <io.h>
00014 #endif
00015
00016 #include <windows.h>
00017 #include <winbase.h>
00018
00019 #include <stdio.h>
00020 #include "log4cpp/Category.hh"
00021 #include "log4cpp/Win32DebugAppender.hh"
00022 #include <log4cpp/FactoryParams.hh>
00023 #include <memory>
00024
00025 namespace log4cpp {
00026
00027 Win32DebugAppender::Win32DebugAppender(const std::string& name) :
00028 LayoutAppender(name) {
00029 }
00030
00031 Win32DebugAppender::~Win32DebugAppender() {
00032 close();
00033 }
00034
00035 void Win32DebugAppender::close() {
00036 }
00037
00038 void Win32DebugAppender::_append(const LoggingEvent& event) {
00039 std::string message(_getLayout().format(event));
00040 ::OutputDebugString(message.c_str());
00041 }
00042
00043 std::auto_ptr<Appender> create_win32_debug_appender(const FactoryParams& params)
00044 {
00045 std::string name;
00046 params.get_for("win32 debug appender").required("name", name);
00047
00048 return std::auto_ptr<Appender>(new Win32DebugAppender(name));
00049 }
00050 }
00051
00052 #endif // WIN32