mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
returned fast_oss with optimizations
This commit is contained in:
@@ -6,23 +6,26 @@
|
||||
|
||||
#include "base_sink.h"
|
||||
|
||||
namespace c11log {
|
||||
namespace sinks {
|
||||
class ostream_sink: public base_sink {
|
||||
namespace c11log
|
||||
{
|
||||
namespace sinks
|
||||
{
|
||||
class ostream_sink: public base_sink
|
||||
{
|
||||
public:
|
||||
explicit ostream_sink(std::ostream& os):_ostream(os) {}
|
||||
ostream_sink(const ostream_sink&) = delete;
|
||||
ostream_sink& operator=(const ostream_sink&) = delete;
|
||||
ostream_sink(const ostream_sink&) = delete;
|
||||
ostream_sink& operator=(const ostream_sink&) = delete;
|
||||
virtual ~ostream_sink() = default;
|
||||
|
||||
protected:
|
||||
virtual void _sink_it(const std::string& msg) override {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
_ostream << msg;
|
||||
}
|
||||
|
||||
std::ostream& _ostream;
|
||||
std::mutex _mutex;
|
||||
std::mutex _mutex;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user