diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-07 20:57:04 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-07 20:57:04 +0800 |
commit | 688d118c7e0d439691e84fc6e068ab3e19da5185 (patch) | |
tree | 6891a60950e0c2956c9f2d4fed6fceb67430775c /p2p/discover | |
parent | 01b2c90179ff82e4610745aea0e3e3ca53756305 (diff) | |
download | dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.gz dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.bz2 dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.lz dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.xz dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.zst dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.zip |
Updated logging
Diffstat (limited to 'p2p/discover')
-rw-r--r-- | p2p/discover/udp.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index e9ede1397..a638a8f35 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -10,12 +10,11 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/rlp" ) -var log = logger.NewLogger("P2P Discovery") - const Version = 3 // Errors @@ -155,7 +154,7 @@ func ListenUDP(priv *ecdsa.PrivateKey, laddr string, natm nat.Interface) (*Table return nil, err } tab, _ := newUDP(priv, conn, natm) - log.Infoln("Listening,", tab.self) + glog.V(logger.Info).Infoln("Listening,", tab.self) return tab, nil } @@ -336,9 +335,9 @@ func (t *udp) send(toaddr *net.UDPAddr, ptype byte, req interface{}) error { if err != nil { return err } - log.DebugDetailf(">>> %v %T %v\n", toaddr, req, req) + glog.V(logger.Detail).Infof(">>> %v %T %v\n", toaddr, req, req) if _, err = t.conn.WriteToUDP(packet, toaddr); err != nil { - log.DebugDetailln("UDP send failed:", err) + glog.V(logger.Detail).Infoln("UDP send failed:", err) } return err } @@ -348,13 +347,13 @@ func encodePacket(priv *ecdsa.PrivateKey, ptype byte, req interface{}) ([]byte, b.Write(headSpace) b.WriteByte(ptype) if err := rlp.Encode(b, req); err != nil { - log.Errorln("error encoding packet:", err) + glog.V(logger.Error).Infoln("error encoding packet:", err) return nil, err } packet := b.Bytes() sig, err := crypto.Sign(crypto.Sha3(packet[headSize:]), priv) if err != nil { - log.Errorln("could not sign packet:", err) + glog.V(logger.Error).Infoln("could not sign packet:", err) return nil, err } copy(packet[macSize:], sig) @@ -376,13 +375,13 @@ func (t *udp) readLoop() { } packet, fromID, hash, err := decodePacket(buf[:nbytes]) if err != nil { - log.Debugf("Bad packet from %v: %v\n", from, err) + glog.V(logger.Debug).Infof("Bad packet from %v: %v\n", from, err) continue } - log.DebugDetailf("<<< %v %T %v\n", from, packet, packet) + glog.V(logger.Detail).Infof("<<< %v %T %v\n", from, packet, packet) go func() { if err := packet.handle(t, from, fromID, hash); err != nil { - log.Debugf("error handling %T from %v: %v", packet, from, err) + glog.V(logger.Debug).Infof("error handling %T from %v: %v", packet, from, err) } }() } |