Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
ostream_sink.h
Go to the documentation of this file.
1//
2// Copyright(c) 2015 Gabi Melman.
3// Distributed under the MIT License (http://opensource.org/licenses/MIT)
4//
5
6#pragma once
7
8#include "../details/null_mutex.h"
9#include "base_sink.h"
10
11#include <ostream>
12#include <mutex>
13
14namespace spdlog
15{
16namespace sinks
17{
18template<class Mutex>
19class ostream_sink: public base_sink<Mutex>
20{
21public:
22 explicit ostream_sink(std::ostream& os, bool force_flush=false) :_ostream(os), _force_flush(force_flush) {}
23 ostream_sink(const ostream_sink&) = delete;
25 virtual ~ostream_sink() = default;
26
27protected:
28 void _sink_it(const details::log_msg& msg) override
29 {
31 if (_force_flush)
33 }
34
35 void _flush() override
36 {
38 }
39
40 std::ostream& _ostream;
42};
43
46}
47}
ostream_sink & operator=(const ostream_sink &)=delete
ostream_sink(const ostream_sink &)=delete
ostream_sink(std::ostream &os, bool force_flush=false)
virtual ~ostream_sink()=default
void _sink_it(const details::log_msg &msg) override
ostream_sink< details::null_mutex > ostream_sink_st
ostream_sink< std::mutex > ostream_sink_mt
Definition json.hpp:4518