MCPcopy Create free account
hub / github.com/ElementsProject/lightning / cap_header

Function cap_header

lightningd/log.c:267–282  ·  view source on GitHub ↗

We truncate genuinely giant messages */

Source from the content-addressed store, hash-verified

265
266/* We truncate genuinely giant messages */
267static char *cap_header(const tal_t *ctx, struct log_hdr *hdr, const char *msg)
268{
269 const size_t max = sizeof(((struct log_book *)0)->ringbuf) / 64;
270 if (hdr->msglen > max) {
271 msg = tal_fmt(ctx, "[TRUNCATED message from %zu bytes]: %.*s",
272 hdr->msglen, (int)max, msg);
273 hdr->msglen = strlen(msg);
274 }
275 if (hdr->iolen > max) {
276 msg = tal_fmt(ctx, "[TRUNCATED IO from %zu bytes]: %.*s",
277 hdr->iolen, (int)hdr->msglen, msg);
278 hdr->msglen = strlen(msg);
279 hdr->iolen = max;
280 }
281 return cast_const(char *, msg);
282}
283
284static void add_entry(struct log_book *log,
285 const struct log_hdr *hdr,

Callers 2

logvFunction · 0.85
log_ioFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected