daemon: add helper to log hex.

Good for keys; eventually we'll want to log structures by type though.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-01-22 06:41:48 +10:30
parent 14cbcd467f
commit 29c8611e53
2 changed files with 8 additions and 0 deletions

View File

@@ -262,6 +262,13 @@ void log_add(struct log *log, const char *fmt, ...)
va_end(ap);
}
void log_add_hex(struct log *log, const void *data, size_t len)
{
char hex[hex_str_size(len)];
hex_encode(data, len, hex, hex_str_size(len));
log_add(log, "%s", hex);
}
void log_each_line_(const struct log_record *lr,
void (*func)(unsigned int skipped,
struct timerel time,