From d86a71f79afe0e4dac768f61d6bff690567aca5b Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 24 May 2020 01:40:02 +0800 Subject: ... --- src/win/DebugLogger.hpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/win/DebugLogger.hpp (limited to 'src/win/DebugLogger.hpp') diff --git a/src/win/DebugLogger.hpp b/src/win/DebugLogger.hpp new file mode 100644 index 00000000..381803bc --- /dev/null +++ b/src/win/DebugLogger.hpp @@ -0,0 +1,24 @@ +#include "cru/win/WinPreConfig.hpp" + +#include "cru/common/Logger.hpp" +#include "cru/win/String.hpp" + +namespace cru::platform::win { + +class WinDebugLoggerSource : public ::cru::log::ILogSource { + public: + WinDebugLoggerSource() = default; + + CRU_DELETE_COPY(WinDebugLoggerSource) + CRU_DELETE_MOVE(WinDebugLoggerSource) + + ~WinDebugLoggerSource() = default; + + void Write(::cru::log::LogLevel level, const std::string_view& s) override { + CRU_UNUSED(level) + + const std::wstring&& ws = ToUtf16String(s); + ::OutputDebugStringW(ws.data()); + } +}; +} // namespace cru::platform::win -- cgit v1.2.3