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

Function log_io

lightningd/log.c:448–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448void log_io(struct log *log, enum log_level dir,
449 const struct node_id *node_id,
450 const char *str TAKES,
451 const void *data TAKES, size_t len)
452{
453 int save_errno = errno;
454 struct log_entry *l = new_log_entry(log, dir, node_id);
455
456 assert(dir == LOG_IO_IN || dir == LOG_IO_OUT);
457
458 /* Print first, in case we need to truncate. */
459 if (l->level >= log_print_level(log, node_id))
460 log_to_files(log->lr->prefix, log->prefix->prefix, l->level,
461 l->nc ? &l->nc->node_id : NULL,
462 &l->time, str,
463 data, len,
464 log->lr->print_timestamps,
465 log->lr->outfiles);
466
467 /* Save a tal header, by using raw malloc. */
468 l->log = strdup(str);
469 if (taken(str))
470 tal_free(str);
471
472 /* Don't immediately fill buffer with giant IOs */
473 if (len > log->lr->max_mem / 64) {
474 l->skipped++;
475 len = log->lr->max_mem / 64;
476 }
477
478 /* FIXME: We could save 4 pointers by using a raw allow, but saving
479 * the length. */
480 l->io = tal_dup_arr(log->lr, u8, data, len, 0);
481
482 add_entry(log, &l);
483 errno = save_errno;
484}
485
486void log_(struct log *log, enum log_level level,
487 const struct node_id *node_id,

Callers 7

plugin_read_jsonFunction · 0.70
log_status_msgFunction · 0.70
parse_requestFunction · 0.70
start_json_streamFunction · 0.70
read_jsonFunction · 0.70
jsonrpc_request_start_Function · 0.70

Calls 6

new_log_entryFunction · 0.85
log_to_filesFunction · 0.85
takenFunction · 0.85
tal_freeFunction · 0.85
add_entryFunction · 0.85
log_print_levelFunction · 0.70

Tested by

no test coverage detected