1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Use std::string_view in logging code

This commit is contained in:
sfan5 2024-08-31 21:23:16 +02:00
parent ac11a14509
commit b8b99d5cf1
7 changed files with 61 additions and 54 deletions

View file

@ -32,14 +32,14 @@ struct ChatInterface;
class TermLogOutput : public ILogOutput {
public:
void logRaw(LogLevel lev, const std::string &line)
void logRaw(LogLevel lev, std::string_view line)
{
queue.push_back(std::make_pair(lev, line));
queue.push_back(std::make_pair(lev, std::string(line)));
}
virtual void log(LogLevel lev, const std::string &combined,
const std::string &time, const std::string &thread_name,
const std::string &payload_text)
std::string_view payload_text)
{
std::ostringstream os(std::ios_base::binary);
os << time << ": [" << thread_name << "] " << payload_text;