mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-24 09:31:34 +08:00
async_sink fixes
This commit is contained in:
parent
7cbf6dcbf7
commit
3a1ac8b4d6
@ -25,7 +25,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
//auto fsink = std::make_shared<sinks::rotating_file_sink>("log", "txt", 1024*1024*50 , 5, 0);
|
||||
|
||||
auto as = std::make_shared<sinks::async_sink>(howmany);
|
||||
auto as = std::make_shared<sinks::async_sink>(1000);
|
||||
as->add_sink(sinks::null_sink::get());
|
||||
logger my_logger ("my_logger", as);
|
||||
|
||||
@ -33,7 +33,7 @@ int main(int argc, char* argv[])
|
||||
for(unsigned int i = 0; i < howmany ; i++)
|
||||
my_logger.info() << "Hello logger";
|
||||
|
||||
|
||||
as->shutdown(milliseconds(5000));
|
||||
auto delta = system_clock::now() - start;
|
||||
auto delta_d = duration_cast<duration<double>> (delta).count();
|
||||
|
||||
|
@ -68,8 +68,8 @@ inline c11log::sinks::async_sink::~async_sink()
|
||||
}
|
||||
inline void c11log::sinks::async_sink::_sink_it(const details::log_msg& msg)
|
||||
{
|
||||
auto msg_size = msg.msg_buf.second;
|
||||
if(!msg_size)
|
||||
auto msg_size = msg.msg_buf.second;
|
||||
if(!_active || !msg_size)
|
||||
return;
|
||||
//re allocate on the heap the (stack based) message
|
||||
auto new_msg = new details::log_msg();
|
||||
|
Loading…
Reference in New Issue
Block a user