diff --git a/pkg/network/p2p/manager.go b/pkg/network/p2p/manager.go index 19aab4f2e..d6ed84420 100644 --- a/pkg/network/p2p/manager.go +++ b/pkg/network/p2p/manager.go @@ -357,7 +357,7 @@ func (m *Manager) addNeighbor(peer *network.Peer, ps *PacketsStream) error { } nbr.readLoop() nbr.writeLoop() - nbr.logger.LogInfo("Connection established") + nbr.logger.LogInfo("Connection established to %s") m.Events.NeighborAdded.Trigger(nbr) return nil diff --git a/pkg/network/p2p/neighbor.go b/pkg/network/p2p/neighbor.go index 4c56344f0..445826453 100644 --- a/pkg/network/p2p/neighbor.go +++ b/pkg/network/p2p/neighbor.go @@ -2,7 +2,6 @@ package p2p import ( "context" - "fmt" "sync" "time" @@ -52,9 +51,9 @@ type Neighbor struct { func NewNeighbor(parentLogger log.Logger, p *network.Peer, stream *PacketsStream, packetReceivedCallback PacketReceivedFunc, disconnectedCallback NeighborDisconnectedFunc) *Neighbor { ctx, cancel := context.WithCancel(context.Background()) - return &Neighbor{ + n := &Neighbor{ Peer: p, - logger: parentLogger.NewChildLogger(fmt.Sprintf("peers.%s", p.ID.String()[:6])), + logger: parentLogger.NewChildLogger("peer", true), packetReceivedFunc: packetReceivedCallback, disconnectedFunc: disconnectedCallback, loopCtx: ctx, @@ -62,6 +61,10 @@ func NewNeighbor(parentLogger log.Logger, p *network.Peer, stream *PacketsStream stream: stream, sendQueue: make(chan *queuedPacket, NeighborsSendQueueSize), } + + n.logger.LogInfo("created", "ID", n.ID) + + return n } func (n *Neighbor) Enqueue(packet proto.Message, protocolID protocol.ID) {