You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spdlog/include/spdlog/sinks/msvc_sink.h

45 lines
782 B
C

9 years ago
//
// Copyright(c) 2016 Alexander Dalshov.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//
#pragma once
#if defined(_WIN32)
9 years ago
#include "../details/null_mutex.h"
8 years ago
#include "base_sink.h"
9 years ago
#include <winbase.h>
9 years ago
#include <mutex>
#include <string>
8 years ago
namespace spdlog {
namespace sinks {
9 years ago
/*
8 years ago
* MSVC sink (logging using OutputDebugStringA)
*/
8 years ago
template<class Mutex>
class msvc_sink : public base_sink<Mutex>
9 years ago
{
public:
8 years ago
explicit msvc_sink() {}
9 years ago
protected:
8 years ago
void _sink_it(const details::log_msg &msg) override
9 years ago
{
OutputDebugStringA(msg.formatted.c_str());
}
8 years ago
void _flush() override {}
9 years ago
};
using msvc_sink_mt = msvc_sink<std::mutex>;
using msvc_sink_st = msvc_sink<details::null_mutex>;
9 years ago
8 years ago
} // namespace sinks
} // namespace spdlog
9 years ago
#endif