Thanks to visit codestin.com
Credit goes to sourceforge.net

Menu

[31e5cd]: / src / Win32DebugAppender.cpp  Maximize  Restore  History

Download this file

51 lines (39 with data), 1.3 kB

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