Win32DebugAppender.cpp
Go to the documentation of this file.
1 /*
2  * Win32DebugAppender.cpp
3  *
4  * Copyright 2002, the Log4cpp project.
5  *
6  * See the COPYING file for the terms of usage and distribution.
7  */
8 
9 #ifdef WIN32 // only available on Win32
10 
11 #include "PortabilityImpl.hh"
12 #ifdef LOG4CPP_HAVE_IO_H
13 # include <io.h>
14 #endif
15 
16 #include <windows.h>
17 #include <winbase.h>
18 
19 #include <stdio.h>
20 #include "log4cpp/Category.hh"
22 #include <log4cpp/FactoryParams.hh>
23 #include <memory>
24 
25 namespace log4cpp {
26 
27  Win32DebugAppender::Win32DebugAppender(const std::string& name) :
28  LayoutAppender(name) {
29  }
30 
31  Win32DebugAppender::~Win32DebugAppender() {
32  close();
33  }
34 
35  void Win32DebugAppender::close() {
36  }
37 
38  void Win32DebugAppender::_append(const LoggingEvent& event) {
39  std::string message(_getLayout().format(event));
40  ::OutputDebugString(message.c_str());
41  }
42 
43  std::auto_ptr<Appender> create_win32_debug_appender(const FactoryParams& params)
44  {
45  std::string name;
46  params.get_for("win32 debug appender").required("name", name);
47 
48  return std::auto_ptr<Appender>(new Win32DebugAppender(name));
49  }
50 }
51 
52 #endif // WIN32
std::auto_ptr< Appender > create_win32_debug_appender(const FactoryParams &)


log4cpp
Author(s): Stephen Roderick, Bastiaan Bakker, Cedric Le Goater, Steve Ostlind, Marcel Harkema, Walter Stroebel, Glenn Scott and Tony Cheung
autogenerated on Sun Jun 23 2019 19:14:17