Set Verbosity of Goodbye Logs to Trace (#13077)

This commit is contained in:
Nishant Das
2023-10-19 11:49:34 +08:00
committed by GitHub
parent f592bf7f07
commit bc125a95ae
6 changed files with 21 additions and 18 deletions

View File

@@ -68,12 +68,8 @@ func (c *client) registerRPCHandler(baseTopic string, handle rpcHandler) {
return
}
if err := c.Encoding().DecodeWithMaxLength(stream, msg); err != nil {
// Debug logs for goodbye/status errors
if strings.Contains(topic, p2p.RPCGoodByeTopicV1) || strings.Contains(topic, p2p.RPCStatusTopicV1) {
log.WithError(err).Debug("Could not decode goodbye stream message")
return
}
log.WithError(err).Debug("Could not decode stream message")
// Trace logs for goodbye errors
logStreamErrors(err, topic)
return
}
if err := handle(context.Background(), msg, stream); err != nil {
@@ -89,7 +85,7 @@ func (c *client) registerRPCHandler(baseTopic string, handle rpcHandler) {
return
}
if err := c.Encoding().DecodeWithMaxLength(stream, msg); err != nil {
log.WithError(err).Debug("Could not decode stream message")
logStreamErrors(err, topic)
return
}
if err := handle(context.Background(), nTyp.Elem().Interface(), stream); err != nil {
@@ -100,3 +96,11 @@ func (c *client) registerRPCHandler(baseTopic string, handle rpcHandler) {
}
})
}
func logStreamErrors(err error, topic string) {
if strings.Contains(topic, p2p.RPCGoodByeTopicV1) {
log.WithError(err).Trace("Could not decode goodbye stream message")
return
}
log.WithError(err).Debug("Could not decode stream message")
}