MCPcopy
hub / github.com/davyxu/cellnet / WriteRecvLogger

Function WriteRecvLogger

msglog/proc.go:13–34  ·  view source on GitHub ↗
(log *golog.Logger, protocol string, ses cellnet.Session, msg interface{})

Source from the content-addressed store, hash-verified

11}
12
13func WriteRecvLogger(log *golog.Logger, protocol string, ses cellnet.Session, msg interface{}) {
14
15 if log.IsDebugEnabled() {
16
17 if peeker, ok := msg.(PacketMessagePeeker); ok {
18 msg = peeker.Message()
19 }
20
21 if IsMsgLogValid(cellnet.MessageToID(msg)) {
22 peerInfo := ses.Peer().(cellnet.PeerProperty)
23
24 log.Debugf("#%s.recv(%s)@%d len: %d %s | %s",
25 protocol,
26 peerInfo.Name(),
27 ses.ID(),
28 cellnet.MessageSize(msg),
29 cellnet.MessageToName(msg),
30 cellnet.MessageToString(msg))
31 }
32
33 }
34}
35
36func WriteSendLogger(log *golog.Logger, protocol string, ses cellnet.Session, msg interface{}) {
37

Callers 3

OnInboundEventMethod · 0.92
OnRecvMessageMethod · 0.92
OnInboundEventMethod · 0.92

Calls 9

MessageToIDFunction · 0.92
MessageSizeFunction · 0.92
MessageToNameFunction · 0.92
MessageToStringFunction · 0.92
IsMsgLogValidFunction · 0.85
MessageMethod · 0.65
PeerMethod · 0.65
NameMethod · 0.65
IDMethod · 0.65

Tested by

no test coverage detected