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

Function logv

lightningd/log.c:418–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418void logv(struct log *log, enum log_level level,
419 const struct node_id *node_id,
420 bool call_notifier,
421 const char *fmt, va_list ap)
422{
423 int save_errno = errno;
424 struct log_entry *l = new_log_entry(log, level, node_id);
425
426 /* This is WARN_UNUSED_RESULT, because everyone should somehow deal
427 * with OOM, even though nobody does. */
428 if (vasprintf(&l->log, fmt, ap) == -1)
429 abort();
430
431 size_t log_len = strlen(l->log);
432
433 /* Sanitize any non-printable characters, and replace with '?' */
434 for (size_t i=0; i<log_len; i++)
435 if (l->log[i] < ' ' || l->log[i] >= 0x7f)
436 l->log[i] = '?';
437
438 maybe_print(log, l);
439
440 add_entry(log, &l);
441
442 if (call_notifier)
443 notify_warning(log->lr->ld, l);
444
445 errno = save_errno;
446}
447
448void log_io(struct log *log, enum log_level dir,
449 const struct node_id *node_id,

Callers 3

log_Function · 0.85
log_backtrace_printFunction · 0.85
fatal_vfmtFunction · 0.85

Calls 5

new_log_entryFunction · 0.85
abortFunction · 0.85
maybe_printFunction · 0.85
add_entryFunction · 0.85
notify_warningFunction · 0.70

Tested by

no test coverage detected