mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-10 17:44:22 +01:00
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>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user