From ea3eef0b5fa80758de82f3789b47dbeb317ef82d Mon Sep 17 00:00:00 2001 From: Alexander Dalshov Date: Sat, 12 Mar 2016 19:55:44 +0300 Subject: [PATCH] add msvc logging sink --- include/spdlog/sinks/msvc_sink.h | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 include/spdlog/sinks/msvc_sink.h diff --git a/include/spdlog/sinks/msvc_sink.h b/include/spdlog/sinks/msvc_sink.h new file mode 100644 index 00000000..0bd8e821 --- /dev/null +++ b/include/spdlog/sinks/msvc_sink.h @@ -0,0 +1,50 @@ +// +// Copyright(c) 2016 Alexander Dalshov. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) +// + +#pragma once + +#if defined(_MSC_VER) + +#include +#include + +#include + +#include +#include + +namespace spdlog +{ +namespace sinks +{ +/* +* MSVC sink (logging using OutputDebugStringA) +*/ +template +class base_msvc_sink : public base_sink < Mutex > +{ +public: + explicit base_msvc_sink() + { + } + + void flush() override + { + } + +protected: + void _sink_it(const details::log_msg& msg) override + { + OutputDebugStringA(msg.formatted.c_str()); + } +}; + +typedef base_msvc_sink msvc_sink_mt; +typedef base_msvc_sink msvc_sink_st; + +} +} + +#endif