Browse Source

subd: use peer log for messages (if any).

This makes much more sense when you ask for a specific peer's log.
Also, we put the peerid rather than pid ().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
parent
commit
57b423625b
  1. 6
      lightningd/peer_control.c
  2. 11
      lightningd/subd.c

6
lightningd/peer_control.c

@ -699,12 +699,10 @@ static void copy_to_parent_log(const char *prefix,
const char *str,
struct peer *peer)
{
const char *idstr = type_to_string(peer, struct pubkey, &peer->id);
if (continued)
log_add(peer->ld->log, "Peer %s: ... %s", idstr, str);
log_add(peer->ld->log, "%s ... %s", prefix, str);
else
log_(peer->ld->log, level, "Peer %s: %s", idstr, str);
tal_free(idstr);
log_(peer->ld->log, level, "%s %s", prefix, str);
}
void populate_peer(struct lightningd *ld, struct peer *peer)

11
lightningd/subd.c

@ -625,7 +625,16 @@ static struct subd *new_subd(struct lightningd *ld,
return tal_free(sd);
}
sd->ld = ld;
sd->log = new_log(sd, ld->log_book, "%s(%u):", name, sd->pid);
if (peer) {
/* FIXME: Use minimal unique pubkey prefix for logs! */
const char *idstr = type_to_string(peer, struct pubkey,
&peer->id);
sd->log = new_log(sd, peer->log_book, "%s(%s):", name, idstr);
tal_free(idstr);
} else {
sd->log = new_log(sd, ld->log_book, "%s(%u):", name, sd->pid);
}
sd->name = name;
sd->must_not_exit = false;
sd->msgname = msgname;

Loading…
Cancel
Save