diff --git a/include/spdlog/sinks/msvc_sink.h b/include/spdlog/sinks/msvc_sink.h index f6c25acb..8fec428d 100644 --- a/include/spdlog/sinks/msvc_sink.h +++ b/include/spdlog/sinks/msvc_sink.h @@ -8,12 +8,13 @@ #include #include -#include -#include - #include #include + +// Avoid including windows.h (https://stackoverflow.com/a/30741042) +extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char *lpOutputString); + namespace spdlog { namespace sinks { /* @@ -23,12 +24,11 @@ template class msvc_sink : public base_sink { public: - explicit msvc_sink() {} + msvc_sink() = default; protected: void sink_it_(const details::log_msg &msg) override { - memory_buf_t formatted; base_sink::formatter_->format(msg, formatted); OutputDebugStringA(fmt::to_string(formatted).c_str());