bitz-server  2.0.3
msvc_sink.h
1 //
2 // Copyright(c) 2016 Alexander Dalshov.
3 // Distributed under the MIT License (http://opensource.org/licenses/MIT)
4 //
5 
6 #pragma once
7 
8 #if defined(_WIN32)
9 
10 #include "../details/null_mutex.h"
11 #include "base_sink.h"
12 
13 #include <winbase.h>
14 
15 #include <mutex>
16 #include <string>
17 
18 namespace spdlog {
19 namespace sinks {
20 /*
21  * MSVC sink (logging using OutputDebugStringA)
22  */
23 template<class Mutex>
24 class msvc_sink : public base_sink<Mutex>
25 {
26 public:
27  explicit msvc_sink() {}
28 
29 protected:
30  void _sink_it(const details::log_msg &msg) override
31  {
32  OutputDebugStringA(msg.formatted.c_str());
33  }
34 
35  void _flush() override {}
36 };
37 
38 using msvc_sink_mt = msvc_sink<std::mutex>;
39 using msvc_sink_st = msvc_sink<details::null_mutex>;
40 
41 } // namespace sinks
42 } // namespace spdlog
43 
44 #endif
Definition: async_logger.h:26