diff --git a/pulsar/internal/connection.go b/pulsar/internal/connection.go index 7010b13bc..c5572a88e 100644 --- a/pulsar/internal/connection.go +++ b/pulsar/internal/connection.go @@ -317,7 +317,7 @@ func (c *connection) waitUntilReady() error { defer c.Unlock() for c.state != connectionReady { - c.log.Debug("Wait until connection is ready. State: ", c.state) + c.log.Debugf("Wait until connection is ready. State: %s", connectionState(c.state)) if c.state == connectionClosed { return errors.New("connection error") } diff --git a/pulsar/internal/lookup_service.go b/pulsar/internal/lookup_service.go index 7fa76a84d..400063d53 100644 --- a/pulsar/internal/lookup_service.go +++ b/pulsar/internal/lookup_service.go @@ -19,7 +19,6 @@ package internal import ( "errors" - "fmt" "net/url" "github.com/gogo/protobuf/proto" @@ -140,12 +139,12 @@ func (ls *lookupService) Lookup(topic string) (*LookupResult, error) { }, nil case pb.CommandLookupTopicResponse_Failed: - errorMsg := "" - if lr.Error != nil { - errorMsg = lr.Error.String() - } - ls.log.Warnf("Failed to lookup topic: %s, error msg: %s", topic, errorMsg) - return nil, fmt.Errorf("failed to lookup topic: %s", errorMsg) + ls.log.WithFields(log.Fields{ + "topic": topic, + "error": lr.GetError(), + "message": lr.GetMessage(), + }).Warn("Failed to lookup topic") + return nil, errors.New(lr.GetError().String()) } }