23 template<
typename TargetStream,
typename ConsoleMutex>
27 using mutex_t =
typename ConsoleMutex::mutex_t;
29 : mutex_(ConsoleMutex::mutex())
30 , file_(TargetStream::stream())
40 std::lock_guard<mutex_t> lock(mutex_);
43 fwrite(formatted.
data(),
sizeof(char), formatted.
size(), file_);
44 fflush(TargetStream::stream());
49 std::lock_guard<mutex_t> lock(mutex_);
55 std::lock_guard<mutex_t> lock(mutex_);
59 void set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter)
override 61 std::lock_guard<mutex_t> lock(mutex_);
79 template<
typename Factory = default_factory>
82 return Factory::template create<sinks::stdout_sink_mt>(logger_name);
85 template<
typename Factory = default_factory>
88 return Factory::template create<sinks::stdout_sink_st>(logger_name);
91 template<
typename Factory = default_factory>
94 return Factory::template create<sinks::stderr_sink_mt>(logger_name);
97 template<
typename Factory = default_factory>
100 return Factory::template create<sinks::stderr_sink_st>(logger_name);
std::unique_ptr< spdlog::formatter > formatter_
void log(const details::log_msg &msg) override
std::shared_ptr< logger > stderr_logger_st(const std::string &logger_name)
~stdout_sink() override=default
typename ConsoleMutex::mutex_t mutex_t
void set_pattern(const std::string &pattern) override
std::shared_ptr< logger > stderr_logger_mt(const std::string &logger_name)
std::shared_ptr< logger > stdout_logger_mt(const std::string &logger_name)
stdout_sink & operator=(const stdout_sink &other)=delete
std::shared_ptr< logger > stdout_logger_st(const std::string &logger_name)
void set_formatter(std::unique_ptr< spdlog::formatter > sink_formatter) override