canonicallog: reduce log level to warning

This commit is contained in:
Marten Seemann 2022-06-26 16:49:03 +02:00
parent b430f5b3a6
commit 5956e99d44

View File

@ -15,18 +15,18 @@ var log = logging.WithSkip(logging.Logger("canonical-log"), 1)
// Protocols should use this to identify a misbehaving peer to allow the end // Protocols should use this to identify a misbehaving peer to allow the end
// user to easily identify these nodes across protocols and libp2p. // user to easily identify these nodes across protocols and libp2p.
func LogMisbehavingPeer(p peer.ID, peerAddr multiaddr.Multiaddr, component string, err error, msg string) { func LogMisbehavingPeer(p peer.ID, peerAddr multiaddr.Multiaddr, component string, err error, msg string) {
log.Errorf("CANONICAL_MISBEHAVING_PEER: peer=%s addr=%s component=%s err=%v msg=%s", p, peerAddr.String(), component, err, msg) log.Warnf("CANONICAL_MISBEHAVING_PEER: peer=%s addr=%s component=%s err=%v msg=%s", p, peerAddr.String(), component, err, msg)
} }
// LogMisbehavingPeer is the canonical way to log a misbehaving peer. // LogMisbehavingPeerNetAddr is the canonical way to log a misbehaving peer.
// Protocols should use this to identify a misbehaving peer to allow the end // Protocols should use this to identify a misbehaving peer to allow the end
// user to easily identify these nodes across protocols and libp2p. // user to easily identify these nodes across protocols and libp2p.
func LogMisbehavingPeerNetAddr(p peer.ID, peerAddr net.Addr, component string, originalErr error, msg string) { func LogMisbehavingPeerNetAddr(p peer.ID, peerAddr net.Addr, component string, originalErr error, msg string) {
ma, err := manet.FromNetAddr(peerAddr) ma, err := manet.FromNetAddr(peerAddr)
if err != nil { if err != nil {
log.Errorf("CANONICAL_MISBEHAVING_PEER: peer=%s netAddr=%s component=%s err=%v fromNetAddrErr=%v msg=%s", p, peerAddr.String(), component, originalErr, err, msg) log.Warnf("CANONICAL_MISBEHAVING_PEER: peer=%s netAddr=%s component=%s err=%v msg=%s", p, peerAddr.String(), component, originalErr, msg)
return return
} }
log.Errorf("CANONICAL_MISBEHAVING_PEER: peer=%s addr=%s component=%s err=%v msg=%s", p, ma, component, originalErr, msg) log.Warnf("CANONICAL_MISBEHAVING_PEER: peer=%s addr=%s component=%s err=%v msg=%s", p, ma, component, originalErr, msg)
} }