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

Function add_entry

lightningd/log.c:284–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284static void add_entry(struct log_book *log,
285 const struct log_hdr *hdr,
286 const char *msg,
287 const u8 *io)
288{
289 void *buf1, *buf2;
290 size_t buf1len, buf2len;
291 size_t needed = sizeof(*hdr) + hdr->msglen + hdr->iolen;
292 assert(needed < sizeof(log->ringbuf));
293
294 while (ringbuf_avail(log) < needed)
295 del_front_log(log);
296
297 ringbuf_span(log, log->ringbuf_end, sizeof(*hdr), &buf1, &buf1len, &buf2, &buf2len);
298 log->ringbuf_end += copy_to(buf1, buf1len, buf2, buf2len, hdr, sizeof(*hdr));
299 ringbuf_span(log, log->ringbuf_end, hdr->msglen, &buf1, &buf1len, &buf2, &buf2len);
300 log->ringbuf_end += copy_to(buf1, buf1len, buf2, buf2len, msg, hdr->msglen);
301 ringbuf_span(log, log->ringbuf_end, hdr->iolen, &buf1, &buf1len, &buf2, &buf2len);
302 log->ringbuf_end += copy_to(buf1, buf1len, buf2, buf2len, io, hdr->iolen);
303}
304
305static const char *level_prefix(enum log_level level)
306{

Callers 2

logvFunction · 0.85
log_ioFunction · 0.85

Calls 4

ringbuf_availFunction · 0.85
del_front_logFunction · 0.85
ringbuf_spanFunction · 0.85
copy_toFunction · 0.85

Tested by

no test coverage detected