@@ -79,21 +79,47 @@ func (s *Server) initProtocol() {
7979
8080func (s * Server ) RollBackward (point common.Point , tip Tip ) error {
8181 s .Protocol .Logger ().
82- Debug (fmt .Sprintf ("%s: server %+v called RollBackward(point: {Slot: %d, Hash: %x}, tip: {Point: %+v, BlockNumber: %d})" , ProtocolName , s .callbackContext .ConnectionId .RemoteAddr , point .Slot , point .Hash , tip .Point , tip .BlockNumber ))
82+ Debug (
83+ fmt .Sprintf ("calling RollBackward(point: {Slot: %d, Hash: %x}, tip: {Point: {Slot: %d, Hash: %x}, BlockNumber: %d})" ,
84+ point .Slot , point .Hash ,
85+ tip .Point .Slot , tip .Point .Hash ,
86+ tip .BlockNumber ,
87+ ),
88+ "component" , "network" ,
89+ "protocol" , ProtocolName ,
90+ "role" , "server" ,
91+ "connection_id" , s .callbackContext .ConnectionId .String (),
92+ )
8393 msg := NewMsgRollBackward (point , tip )
8494 return s .SendMessage (msg )
8595}
8696
8797func (s * Server ) AwaitReply () error {
8898 s .Protocol .Logger ().
89- Debug (fmt .Sprintf ("%s: server %+v called AwaitReply()" , ProtocolName , s .callbackContext .ConnectionId .RemoteAddr ))
99+ Debug ("calling AwaitReply()" ,
100+ "component" , "network" ,
101+ "protocol" , ProtocolName ,
102+ "role" , "server" ,
103+ "connection_id" , s .callbackContext .ConnectionId .String (),
104+ )
90105 msg := NewMsgAwaitReply ()
91106 return s .SendMessage (msg )
92107}
93108
94109func (s * Server ) RollForward (blockType uint , blockData []byte , tip Tip ) error {
95110 s .Protocol .Logger ().
96- Debug (fmt .Sprintf ("%s: server %+v called RollForward(blockType: %+v, blockData: %x, tip: {Point: {Slot: %d, Hash: %x}, BlockNumber: %d})" , ProtocolName , s .callbackContext .ConnectionId .RemoteAddr , blockType , blockData , tip .Point .Slot , tip .Point .Hash , tip .BlockNumber ))
111+ Debug (
112+ fmt .Sprintf ("calling RollForward(blockType: %+x, blockData: %x, tip: {Point: {Slot: %d, Hash: %x}, BlockNumber: %d})" ,
113+ blockType ,
114+ blockData ,
115+ tip .Point .Slot , tip .Point .Hash ,
116+ tip .BlockNumber ,
117+ ),
118+ "component" , "network" ,
119+ "protocol" , ProtocolName ,
120+ "role" , "server" ,
121+ "connection_id" , s .callbackContext .ConnectionId .String (),
122+ )
97123 if s .Mode () == protocol .ProtocolModeNodeToNode {
98124 eraId := ledger .BlockToBlockHeaderTypeMap [blockType ]
99125 msg := NewMsgRollForwardNtN (
@@ -136,7 +162,12 @@ func (s *Server) handleRequestNext() error {
136162 // TODO: figure out why this one log message causes a panic (and only this one)
137163 // during tests
138164 //s.Protocol.Logger().
139- // Debug(fmt.Sprintf("%s: server request next for %+v", ProtocolName, s.callbackContext.ConnectionId.RemoteAddr))
165+ // Debug("request next",
166+ // "component", "network",
167+ // "protocol", ProtocolName,
168+ // "role", "server",
169+ // "connection_id", s.callbackContext.ConnectionId.String(),
170+ // )
140171 if s .config == nil || s .config .RequestNextFunc == nil {
141172 return fmt .Errorf (
142173 "received chain-sync RequestNext message but no callback function is defined" ,
@@ -147,7 +178,12 @@ func (s *Server) handleRequestNext() error {
147178
148179func (s * Server ) handleFindIntersect (msg protocol.Message ) error {
149180 s .Protocol .Logger ().
150- Debug (fmt .Sprintf ("%s: server find intersect for %+v" , ProtocolName , s .callbackContext .ConnectionId .RemoteAddr ))
181+ Debug ("find intersect" ,
182+ "component" , "network" ,
183+ "protocol" , ProtocolName ,
184+ "role" , "server" ,
185+ "connection_id" , s .callbackContext .ConnectionId .String (),
186+ )
151187 if s .config == nil || s .config .FindIntersectFunc == nil {
152188 return fmt .Errorf (
153189 "received chain-sync FindIntersect message but no callback function is defined" ,
@@ -177,7 +213,12 @@ func (s *Server) handleFindIntersect(msg protocol.Message) error {
177213
178214func (s * Server ) handleDone () error {
179215 s .Protocol .Logger ().
180- Debug (fmt .Sprintf ("%s: server done for %+v" , ProtocolName , s .callbackContext .ConnectionId .RemoteAddr ))
216+ Debug ("done" ,
217+ "component" , "network" ,
218+ "protocol" , ProtocolName ,
219+ "role" , "server" ,
220+ "connection_id" , s .callbackContext .ConnectionId .String (),
221+ )
181222 // Restart protocol
182223 s .Protocol .Stop ()
183224 s .initProtocol ()
0 commit comments