merlimat commented on a change in pull request #12: package logrus for project
URL: https://github.com/apache/pulsar-client-go/pull/12#discussion_r284930412
 
 

 ##########
 File path: pulsar/internal/lookup_service.go
 ##########
 @@ -81,7 +81,7 @@ func (ls *lookupService) Lookup(topic string) 
(*LookupResult, error) {
                        return nil, err
                }
 
-               log.WithField("topic", topic).Debugf("Got topic lookup 
response: %s", res)
+               log.Debugf("got topic: %s lookup response: %s", topic, res)
 
 Review comment:
   Using the `WithField()` provides a consistent way to present the context. In 
this file we're already changing 3 different ways to present the topic: 
   ```go
   log.Debugf("got topic: %s lookup response: %s", topic, res)
   log.Debugf("follow redirect to broker. %v / %v - Use proxy: %v - Topic is: 
%s",
   log.Debugf("successfully looked up topic [%s] on broker. %s / %s - Use 
proxy: %t",
   ```
   
   `WithField()` will always attach `topic=my-topic` to the log line. If I want 
to grep for that topic, that makes the life much easier even in text format.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to