mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
logger refactoring to init lists and mutex remove
This commit is contained in:
@@ -20,8 +20,8 @@ public:
|
||||
|
||||
explicit async_sink(const size_type max_queue_size);
|
||||
~async_sink();
|
||||
void add_sink(logger::sink_ptr_t sink);
|
||||
void remove_sink(logger::sink_ptr_t sink_ptr);
|
||||
void add_sink(logger::sink_ptr sink);
|
||||
void remove_sink(logger::sink_ptr sink_ptr);
|
||||
|
||||
//Wait to remaining items (if any) in the queue to be written and shutdown
|
||||
void shutdown(const std::chrono::seconds& timeout);
|
||||
@@ -78,12 +78,12 @@ inline void c11log::sinks::async_sink::_thread_loop()
|
||||
}
|
||||
}
|
||||
|
||||
inline void c11log::sinks::async_sink::add_sink(logger::sink_ptr_t sink)
|
||||
inline void c11log::sinks::async_sink::add_sink(logger::sink_ptr sink)
|
||||
{
|
||||
_sinks.push_back(sink);
|
||||
}
|
||||
|
||||
inline void c11log::sinks::async_sink::remove_sink(logger::sink_ptr_t sink_ptr)
|
||||
inline void c11log::sinks::async_sink::remove_sink(logger::sink_ptr sink_ptr)
|
||||
{
|
||||
_sinks.erase(std::remove(_sinks.begin(), _sinks.end(), sink_ptr), _sinks.end());
|
||||
}
|
||||
|
@@ -31,14 +31,14 @@ protected:
|
||||
|
||||
inline std::shared_ptr<console_sink>& stdout_sink ()
|
||||
{
|
||||
static auto inst = std::make_shared<console_sink>(std::cout);
|
||||
return inst;
|
||||
static auto inst = std::make_shared<console_sink>(std::cout);
|
||||
return inst;
|
||||
}
|
||||
|
||||
inline std::shared_ptr<console_sink>& stderr_sink ()
|
||||
{
|
||||
static auto inst = std::make_shared<console_sink>(std::cerr);
|
||||
return inst;
|
||||
static auto inst = std::make_shared<console_sink>(std::cerr);
|
||||
return inst;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user