Skip to content

Commit

Permalink
refactor: rename some log fields to be more consistent
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Stewart <[email protected]>
  • Loading branch information
paralin committed Jun 21, 2024
1 parent e3e7057 commit bc2a5cb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions link/establish-link.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ func (d *establishLinkWithPeer) GetName() string {
// This is not necessarily unique, and is primarily intended for display.
func (d *establishLinkWithPeer) GetDebugVals() directive.DebugValues {
vals := directive.NewDebugValues()
vals["peer-id"] = []string{d.EstablishLinkTargetPeerId().String()}
vals["dst-peer"] = []string{d.EstablishLinkTargetPeerId().String()}
if src := d.EstablishLinkSourcePeerId(); len(src) != 0 {
vals["from-peer-id"] = []string{d.EstablishLinkSourcePeerId().String()}
vals["src-peer"] = []string{d.EstablishLinkSourcePeerId().String()}
}
return vals
}
Expand Down
4 changes: 2 additions & 2 deletions router/directive.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ func (d *DiscoverRoutesWithPeerIDs) GetName() string {
func (d *DiscoverRoutesWithPeerIDs) GetDebugVals() directive.DebugValues {
vals := directive.DebugValues{}
if pid := d.DiscoverRoutesLocalPeerID(); pid != peer.ID("") {
vals["local-peer-id"] = []string{pid.String()}
vals["src-peer"] = []string{pid.String()}
}
if pid := d.DiscoverRoutesRemotePeerID(); pid != peer.ID("") {
vals["remote-peer-id"] = []string{pid.String()}
vals["dst-peer"] = []string{pid.String()}
}
return vals
}
Expand Down
4 changes: 2 additions & 2 deletions signaling/rpc/server/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (s *Server) Session(strm signaling.SRPCSignaling_SessionStream) error {
srcPeerIDStr := srcPeerID.String()

// Wait for the init message.
le := s.le.WithField("src-peer-id", srcPeerIDStr)
le := s.le.WithField("src-peer", srcPeerIDStr)
req, err := strm.Recv()
if err == nil && req.GetSessionSeqno() != 0 {
err = errors.New("session seqno must be zero in init packet")
Expand All @@ -124,7 +124,7 @@ func (s *Server) Session(strm signaling.SRPCSignaling_SessionStream) error {
return errors.New("signaling: cannot open session with self")
}

le = le.WithField("dst-peer-id", dstPeerIDStr)
le = le.WithField("dst-peer", dstPeerIDStr)
le.Debug("signaling: server: starting session")
sessKey, localIsPeerA := newSessionKey(srcPeerIDStr, dstPeerIDStr)
ourPeerTkr := &sessionPeerTracker{}
Expand Down
4 changes: 2 additions & 2 deletions stream/relay/stream_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ type MountedStreamHandler struct {
// NewMountedStreamHandler constructs the mounted stream handler.
func NewMountedStreamHandler(le *logrus.Entry, bus bus.Bus, targetPeerID peer.ID, targetProtocolID protocol.ID) (*MountedStreamHandler, error) {
le = le.WithFields(logrus.Fields{
"target-peer-id": targetPeerID.String(),
"target-protocol-id": targetProtocolID,
"dst-peer": targetPeerID.String(),
"dst-protocol-id": targetProtocolID,
})
return &MountedStreamHandler{le: le, targetPeerID: targetPeerID, targetProtocolID: targetProtocolID, bus: bus}, nil
}
Expand Down
4 changes: 2 additions & 2 deletions transport/controller/open-stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ func (o *openStreamResolver) Resolve(ctx context.Context, handler directive.Reso
WithFields(logrus.Fields{
"link-id": lnk.GetUUID(),
"protocol-id": protocolID,
"src-peer-id": lnk.GetLocalPeer().String(),
"dst-peer-id": lnk.GetRemotePeer().String(),
"src-peer": lnk.GetLocalPeer().String(),
"dst-peer": lnk.GetRemotePeer().String(),
}).
Debug("opened stream with peer")
strmCh <- newMountedStream(strm, openOpts, protocolID, lnk)
Expand Down

0 comments on commit bc2a5cb

Please sign in to comment.