lokinet/llarp/util/json_logger.cpp
2019-06-13 09:26:34 -04:00

20 lines
544 B
C++

#include <util/json_logger.hpp>
#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());
}
} // namespace llarp