core-lightning/lightningd/log_status.c
Rusty Russell e93682e3bf status: make status_io a more generic mechanism.
Currently it's always for messages to peer: make that status_peer_io and
add a new status_io for other IO.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-05-10 02:28:44 +00:00

23 lines
546 B
C

#include <common/gen_status_wire.h>
#include <lightningd/log_status.h>
bool log_status_msg(struct log *log, const u8 *msg)
{
char *entry, *who;
u8 *data;
enum log_level level;
if (fromwire_status_log(msg, msg, &level, &entry)) {
if (level != LOG_IO_IN && level != LOG_IO_OUT) {
log_(log, level, "%s", entry);
return true;
}
} else if (fromwire_status_io(msg, msg, &level, &who, &data)) {
if (level == LOG_IO_IN || level == LOG_IO_OUT) {
log_io(log, level, who, data, tal_len(data));
return true;
}
}
return false;
}