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

Function log_status_msg

lightningd/log_status.c:5–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <lightningd/log_status.h>
4
5bool log_status_msg(struct logger *log,
6 const struct node_id *node_id,
7 const u8 *msg)
8{
9 char *entry, *who;
10 u8 *data;
11 struct node_id *suggested_node_id;
12 enum log_level level;
13 bool call_notifier;
14
15 if (fromwire_status_log(msg, msg, &level, &suggested_node_id, &entry)) {
16 /* If there's not already a node_id (global subdirs), they can
17 * set it */
18 if (!node_id)
19 node_id = suggested_node_id;
20 /* No per-peer daemon should claim a different peer! */
21 else if (suggested_node_id
22 && !node_id_eq(node_id, suggested_node_id))
23 return false;
24
25 if (level != LOG_IO_IN && level != LOG_IO_OUT) {
26 call_notifier = (level == LOG_BROKEN ||
27 level == LOG_UNUSUAL)? true : false;
28 log_(log, level, node_id, call_notifier, "%s", entry);
29 return true;
30 }
31 /* FIXME: This would be far more efficient to copy to log in place, rather than doing the additional allocation in fromwire. */
32 } else if (fromwire_status_io(msg, msg, &level, &suggested_node_id,
33 &who, &data)) {
34 if (level == LOG_IO_IN || level == LOG_IO_OUT) {
35 if (!node_id)
36 node_id = suggested_node_id;
37 log_io(log, level, node_id, who, data, tal_count(data));
38 return true;
39 }
40 }
41 return false;
42}

Callers 1

sd_msg_readFunction · 0.70

Calls 3

node_id_eqFunction · 0.85
log_Function · 0.70
log_ioFunction · 0.70

Tested by

no test coverage detected