lokinet/llarp/util/logging/json_logger.cpp

21 lines
553 B
C++
Raw Normal View History

2019-09-01 12:10:49 +00:00
#include <util/logging/json_logger.hpp>
2019-06-13 13:26:34 +00:00
#include <util/json.hpp>
namespace llarp
{
void
JSONLogStream::AppendLog(LogLevel lvl, const char* fname, int lineno,
const std::string& nodename, const std::string msg)
{
json::Object obj;
obj["time"] = llarp::time_now_ms();
obj["nickname"] = nodename;
obj["file"] = std::string(fname);
obj["line"] = lineno;
obj["level"] = LogLevelToString(lvl);
obj["message"] = msg;
m_Lines.emplace_back(obj.dump());
}
2019-09-01 12:10:49 +00:00
} // namespace llarp