mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
removed the use of str() in when building the log to improve perf even more
This commit is contained in:
@@ -67,7 +67,7 @@ inline c11log::sinks::async_sink::~async_sink()
|
||||
|
||||
inline void c11log::sinks::async_sink::_sink_it(const details::log_msg& msg)
|
||||
{
|
||||
if(!_active || msg.formatted.empty())
|
||||
if(!_active)
|
||||
return;
|
||||
_q.push(msg);
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
protected:
|
||||
void _sink_it(const details::log_msg& msg) override
|
||||
{
|
||||
_flush_helper.write(msg.formatted, _ofstream);
|
||||
_flush_helper.write(msg, _ofstream);
|
||||
}
|
||||
private:
|
||||
std::ofstream _ofstream;
|
||||
@@ -71,7 +71,7 @@ protected:
|
||||
_rotate();
|
||||
_current_size = msg.formatted.size();
|
||||
}
|
||||
_flush_helper.write(msg.formatted, _ofstream);
|
||||
_flush_helper.write(msg, _ofstream);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ protected:
|
||||
_ofstream.open(_calc_filename(_base_filename, _extension));
|
||||
_midnight_tp = _calc_midnight_tp();
|
||||
}
|
||||
_flush_helper.write(msg.formatted, _ofstream);
|
||||
_flush_helper.write(msg, _ofstream);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -24,7 +24,8 @@ public:
|
||||
protected:
|
||||
virtual void _sink_it(const details::log_msg& msg) override
|
||||
{
|
||||
_ostream << msg.formatted;
|
||||
auto buf = msg.formatted.buf();
|
||||
_ostream.write(buf.data(), buf.size());
|
||||
}
|
||||
std::ostream& _ostream;
|
||||
};
|
||||
|
Reference in New Issue
Block a user