mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Support structured logs
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
This commit is contained in:
@@ -17,7 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <xrpl/logging/JsonLogs.h>
|
#include <xrpl/telemetry/JsonLogs.h>
|
||||||
|
#include <xrpl/json/to_string.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace log {
|
namespace log {
|
||||||
|
|
||||||
@@ -100,14 +102,14 @@ JsonStructuredJournal::Logger::write(
|
|||||||
threadIdStream << std::this_thread::get_id();
|
threadIdStream << std::this_thread::get_id();
|
||||||
globalContext["ThreadId"] = threadIdStream.str();
|
globalContext["ThreadId"] = threadIdStream.str();
|
||||||
globalContext["Params"] = messageParams;
|
globalContext["Params"] = messageParams;
|
||||||
globalContext["Level"] = Logs::toString(Logs::fromSeverity(level));
|
globalContext["Level"] = beast::severities::to_string(level);
|
||||||
globalContext["Message"] = text;
|
globalContext["Message"] = text;
|
||||||
globalContext["Time"] =
|
globalContext["Time"] =
|
||||||
to_string(std::chrono::duration_cast<std::chrono::milliseconds>(
|
to_string(std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::system_clock::now().time_since_epoch())
|
std::chrono::system_clock::now().time_since_epoch())
|
||||||
.count());
|
.count());
|
||||||
|
|
||||||
sink->write(level, Json::jsonAsString(globalContext));
|
sink->write(level, to_string(globalContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonStructuredJournal::Logger
|
JsonStructuredJournal::Logger
|
||||||
|
|||||||
Reference in New Issue
Block a user