From 293bf47fe2c1645c0050c1d8f5e2bddb810e199d Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 11 Dec 2024 18:20:08 +0100 Subject: [PATCH] fix: Clamp Event strings When an event is rejected because it's too large, the entire event is printed to the log. This floods the log and makes it totally unreadable. So this change clamps it to 200 chars. --- src/WriterPipeline.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WriterPipeline.h b/src/WriterPipeline.h index 3f6ab7f..22f92e8 100644 --- a/src/WriterPipeline.h +++ b/src/WriterPipeline.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include "golpe.h" @@ -71,7 +72,7 @@ struct WriterPipeline { try { parseAndVerifyEvent(m.eventJson, secpCtx, verifyMsg, verifyTime, packedStr, jsonStr); } catch (std::exception &e) { - if (verboseReject) LW << "Rejected event: " << m.eventJson << " reason: " << e.what(); + if (verboseReject) LW << "Rejected event: " << m.eventJson.get_string().substr(0,200) << " reason: " << e.what(); numLive--; totalRejected++; continue;