Logging what really caused lookup failure (#450)

* Logging what caused lookup failure

* Logging by fields
diff --git a/pulsar/internal/connection.go b/pulsar/internal/connection.go
index 7010b13..c5572a8 100644
--- a/pulsar/internal/connection.go
+++ b/pulsar/internal/connection.go
@@ -317,7 +317,7 @@
 	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 7fa76a8..400063d 100644
--- a/pulsar/internal/lookup_service.go
+++ b/pulsar/internal/lookup_service.go
@@ -19,7 +19,6 @@
 
 import (
 	"errors"
-	"fmt"
 	"net/url"
 
 	"github.com/gogo/protobuf/proto"
@@ -140,12 +139,12 @@
 			}, 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())
 		}
 	}