all: blidly swap out glog to our log15, logs need rework

This commit is contained in:
Péter Szilágyi
2017-02-22 14:10:07 +02:00
parent 47af53f9aa
commit d4fd06c3dc
147 changed files with 1546 additions and 3693 deletions

View File

@ -31,8 +31,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/ecies"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/log"
"golang.org/x/crypto/pbkdf2"
)
@ -144,7 +143,7 @@ func (msg *SentMessage) appendPadding(params *MessageParams) {
func (msg *SentMessage) sign(key *ecdsa.PrivateKey) error {
if isMessageSigned(msg.Raw[0]) {
// this should not happen, but no reason to panic
glog.V(logger.Error).Infof("Trying to sign a message which was already signed")
log.Error(fmt.Sprintf("Trying to sign a message which was already signed"))
return nil
}
@ -238,7 +237,7 @@ func (msg *SentMessage) Wrap(options *MessageParams) (envelope *Envelope, err er
}
}
if len(msg.Raw) > MaxMessageLength {
glog.V(logger.Error).Infof("Message size must not exceed %d bytes", MaxMessageLength)
log.Error(fmt.Sprintf("Message size must not exceed %d bytes", MaxMessageLength))
return nil, errors.New("Oversized message")
}
var salt, nonce []byte
@ -281,7 +280,7 @@ func (msg *ReceivedMessage) decryptSymmetric(key []byte, salt []byte, nonce []by
}
if len(nonce) != aesgcm.NonceSize() {
info := fmt.Sprintf("Wrong AES nonce size - want: %d, got: %d", len(nonce), aesgcm.NonceSize())
glog.V(logger.Error).Infof(info)
log.Error(fmt.Sprintf(info))
return errors.New(info)
}
decrypted, err := aesgcm.Open(nil, nonce, msg.Raw, nil)
@ -352,7 +351,7 @@ func (msg *ReceivedMessage) SigToPubKey() *ecdsa.PublicKey {
pub, err := crypto.SigToPub(msg.hash(), msg.Signature)
if err != nil {
glog.V(logger.Error).Infof("Could not get public key from signature: %v", err)
log.Error(fmt.Sprintf("Could not get public key from signature: %v", err))
return nil
}
return pub