Use string_view for log params
This commit is contained in:
+1
-1
@@ -303,7 +303,7 @@ struct fatal_error_listener final : logs::listener
|
||||
public:
|
||||
~fatal_error_listener() override = default;
|
||||
|
||||
void log(u64 /*stamp*/, const logs::message& msg, const std::string& prefix, const std::string& text) override
|
||||
void log(u64 /*stamp*/, const logs::message& msg, std::string_view prefix, std::string_view text) override
|
||||
{
|
||||
if (msg == logs::level::fatal || (msg == logs::level::always && m_log_always))
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ struct gui_listener : logs::listener
|
||||
{
|
||||
}
|
||||
|
||||
void log(u64 stamp, const logs::message& msg, const std::string& prefix, const std::string& text) override
|
||||
void log(u64 stamp, const logs::message& msg, std::string_view prefix, std::string_view text) override
|
||||
{
|
||||
Q_UNUSED(stamp)
|
||||
|
||||
|
||||
+4
-4
@@ -118,7 +118,7 @@ namespace logs
|
||||
|
||||
~file_listener() override = default;
|
||||
|
||||
void log(u64 stamp, const message& msg, const std::string& prefix, const std::string& text) override;
|
||||
void log(u64 stamp, const message& msg, std::string_view prefix, std::string_view text) override;
|
||||
|
||||
void sync() override
|
||||
{
|
||||
@@ -138,7 +138,7 @@ namespace logs
|
||||
~root_listener() override = default;
|
||||
|
||||
// Encode level, current thread name, channel name and write log message
|
||||
void log(u64, const message&, const std::string&, const std::string&) override
|
||||
void log(u64, const message&, std::string_view, std::string_view) override
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
@@ -251,7 +251,7 @@ namespace logs
|
||||
{
|
||||
std::lock_guard lock(g_mutex);
|
||||
|
||||
auto found = get_logger()->channels.equal_range(ch_name);
|
||||
const auto found = get_logger()->channels.equal_range(ch_name);
|
||||
|
||||
if (found.first != found.second)
|
||||
{
|
||||
@@ -771,7 +771,7 @@ logs::file_listener::file_listener(const std::string& path, u64 max_size)
|
||||
file_writer::log("\xEF\xBB\xBF", 3);
|
||||
}
|
||||
|
||||
void logs::file_listener::log(u64 stamp, const logs::message& msg, const std::string& prefix, const std::string& _text)
|
||||
void logs::file_listener::log(u64 stamp, const logs::message& msg, std::string_view prefix, std::string_view _text)
|
||||
{
|
||||
/*constinit thread_local*/ std::string text;
|
||||
text.reserve(50000);
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ namespace logs
|
||||
virtual ~listener();
|
||||
|
||||
// Process log message
|
||||
virtual void log(u64 stamp, const message& msg, const std::string& prefix, const std::string& text) = 0;
|
||||
virtual void log(u64 stamp, const message& msg, std::string_view prefix, std::string_view text) = 0;
|
||||
|
||||
// Flush contents (file writer)
|
||||
virtual void sync();
|
||||
|
||||
Reference in New Issue
Block a user