mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
lightningd: fix logging of peer death.
We used level -1 to mean "append to log", but that doesn't actually work, and results in an assert if we try to prune the logs: lightningd: daemon/pseudorand.c:36: pseudorand: Assertion `max' failed. Expose logv_add and use that. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
5b1d60839a
commit
9327aa1df4
@ -235,7 +235,7 @@ void log_io(struct log *log, bool in, const void *data, size_t len)
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
static void do_log_add(struct log *log, const char *fmt, va_list ap)
|
||||
void logv_add(struct log *log, const char *fmt, va_list ap)
|
||||
{
|
||||
struct log_entry *l = list_tail(&log->lr->log, struct log_entry, list);
|
||||
size_t oldlen = strlen(l->log);
|
||||
@ -266,7 +266,7 @@ void log_add(struct log *log, const char *fmt, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
do_log_add(log, fmt, ap);
|
||||
logv_add(log, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ void log_(struct log *log, enum log_level level, const char *fmt, ...)
|
||||
PRINTF_FMT(3,4);
|
||||
void log_add(struct log *log, const char *fmt, ...) PRINTF_FMT(2,3);
|
||||
void logv(struct log *log, enum log_level level, const char *fmt, va_list ap);
|
||||
void logv_add(struct log *log, const char *fmt, va_list ap);
|
||||
|
||||
void log_blob_(struct log *log, int level, const char *fmt,
|
||||
size_t len, ...)
|
||||
|
@ -112,7 +112,7 @@ void peer_fail(struct peer *peer, const char *fmt, ...)
|
||||
va_start(ap, fmt);
|
||||
log_info(peer->log, "Peer failure in %s: ",
|
||||
peer_state_name(peer->state));
|
||||
logv(peer->log, -1, fmt, ap);
|
||||
logv_add(peer->log, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
/* If we haven't reached awaiting locked, we don't need to reconnect */
|
||||
|
Loading…
Reference in New Issue
Block a user