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
|
2020-04-07 18:38:56 +00:00
|
|
|
JSONLogStream::AppendLog(
|
|
|
|
LogLevel lvl,
|
|
|
|
const char* fname,
|
|
|
|
int lineno,
|
|
|
|
const std::string& nodename,
|
|
|
|
const std::string msg)
|
2019-06-13 13:26:34 +00:00
|
|
|
{
|
|
|
|
json::Object obj;
|
2020-04-07 18:38:56 +00:00
|
|
|
obj["time"] = to_json(llarp::time_now_ms());
|
2019-06-13 13:26:34 +00:00
|
|
|
obj["nickname"] = nodename;
|
2020-04-07 18:38:56 +00:00
|
|
|
obj["file"] = std::string(fname);
|
|
|
|
obj["line"] = lineno;
|
|
|
|
obj["level"] = LogLevelToString(lvl);
|
|
|
|
obj["message"] = msg;
|
2019-11-15 21:16:46 +00:00
|
|
|
m_Lines.pushBack(obj.dump());
|
2019-06-13 13:26:34 +00:00
|
|
|
}
|
|
|
|
|
2019-09-01 12:10:49 +00:00
|
|
|
} // namespace llarp
|