diff options
Diffstat (limited to 'whisper/whisperv5/api.go')
-rw-r--r-- | whisper/whisperv5/api.go | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/whisper/whisperv5/api.go b/whisper/whisperv5/api.go index 4d33d2321..d34213e05 100644 --- a/whisper/whisperv5/api.go +++ b/whisper/whisperv5/api.go @@ -25,8 +25,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/log" ) var whisperOffLineErr = errors.New("whisper is offline") @@ -170,25 +169,25 @@ func (api *PublicWhisperAPI) NewFilter(args WhisperFilterArgs) (string, error) { if len(args.Topics) == 0 && len(args.KeyName) != 0 { info := "NewFilter: at least one topic must be specified" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return "", errors.New(info) } if len(args.KeyName) != 0 && len(filter.KeySym) == 0 { info := "NewFilter: key was not found by name: " + args.KeyName - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return "", errors.New(info) } if len(args.To) == 0 && len(filter.KeySym) == 0 { info := "NewFilter: filter must contain either symmetric or asymmetric key" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return "", errors.New(info) } if len(args.To) != 0 && len(filter.KeySym) != 0 { info := "NewFilter: filter must not contain both symmetric and asymmetric key" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return "", errors.New(info) } @@ -196,13 +195,13 @@ func (api *PublicWhisperAPI) NewFilter(args WhisperFilterArgs) (string, error) { dst := crypto.ToECDSAPub(common.FromHex(args.To)) if !ValidatePublicKey(dst) { info := "NewFilter: Invalid 'To' address" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return "", errors.New(info) } filter.KeyAsym = api.whisper.GetIdentity(string(args.To)) if filter.KeyAsym == nil { info := "NewFilter: non-existent identity provided" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return "", errors.New(info) } } @@ -210,7 +209,7 @@ func (api *PublicWhisperAPI) NewFilter(args WhisperFilterArgs) (string, error) { if len(args.From) > 0 { if !ValidatePublicKey(filter.Src) { info := "NewFilter: Invalid 'From' address" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return "", errors.New(info) } } @@ -269,13 +268,13 @@ func (api *PublicWhisperAPI) Post(args PostArgs) error { pub := crypto.ToECDSAPub(common.FromHex(args.From)) if !ValidatePublicKey(pub) { info := "Post: Invalid 'From' address" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return errors.New(info) } params.Src = api.whisper.GetIdentity(string(args.From)) if params.Src == nil { info := "Post: non-existent identity provided" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return errors.New(info) } } @@ -283,7 +282,7 @@ func (api *PublicWhisperAPI) Post(args PostArgs) error { filter := api.whisper.GetFilter(args.FilterID) if filter == nil && len(args.FilterID) > 0 { info := fmt.Sprintf("Post: wrong filter id %s", args.FilterID) - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return errors.New(info) } @@ -299,7 +298,7 @@ func (api *PublicWhisperAPI) Post(args PostArgs) error { sz := len(filter.Topics) if sz < 1 { info := fmt.Sprintf("Post: no topics in filter # %s", args.FilterID) - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return errors.New(info) } else if sz == 1 { params.Topic = filter.Topics[0] @@ -314,26 +313,26 @@ func (api *PublicWhisperAPI) Post(args PostArgs) error { // validate if len(args.KeyName) != 0 && len(params.KeySym) == 0 { info := "Post: key was not found by name: " + args.KeyName - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return errors.New(info) } if len(args.To) == 0 && len(params.KeySym) == 0 { info := "Post: message must be encrypted either symmetrically or asymmetrically" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return errors.New(info) } if len(args.To) != 0 && len(params.KeySym) != 0 { info := "Post: ambigous encryption method requested" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return errors.New(info) } if len(args.To) > 0 { if !ValidatePublicKey(params.Dst) { info := "Post: Invalid 'To' address" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return errors.New(info) } } @@ -342,17 +341,17 @@ func (api *PublicWhisperAPI) Post(args PostArgs) error { message := NewSentMessage(¶ms) envelope, err := message.Wrap(¶ms) if err != nil { - glog.V(logger.Error).Infof(err.Error()) + log.Error(fmt.Sprintf(err.Error())) return err } if len(envelope.Data) > MaxMessageLength { info := "Post: message is too big" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return errors.New(info) } if (envelope.Topic == TopicType{} && envelope.IsSymmetric()) { info := "Post: topic is missing for symmetric encryption" - glog.V(logger.Error).Infof(info) + log.Error(fmt.Sprintf(info)) return errors.New(info) } |