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.
This commit is contained in:
Kroese
2024-12-11 18:20:08 +01:00
committed by GitHub
parent 60d35a6b8b
commit 293bf47fe2

View File

@ -1,5 +1,6 @@
#pragma once
#include<string.h>
#include <hoytech/protected_queue.h>
#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;