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

 ##########
 File path: pulsar/impl_partition_producer.go
 ##########
 @@ -134,7 +131,7 @@ func (p *partitionProducer) grabCnx() error {
        })
 
        if err != nil {
-               p.log.WithError(err).Error("Failed to create producer")
+               log.Errorf("create producer [%s] error: %+v", *p.producerName, 
err)
 
 Review comment:
   If you remove the context, all these logs will have no sense. The logs are 
supposed to be relative to some event which will have some context, eg. 
`topic=my-topic, producer-name=my-producer`. These are vital fro the logs. 
   
   Repeating the the context information each time has 2 problems: 
    * It's hard to be consistent throughout the code base in terms of naming 
and parameters
    * We'd be losing the semi-structure of the logs
   
   Saving the logger as part of the state ensure that we always have the 
context, added in a consistent way and will let the application process the 
logs easily.
   

----------------------------------------------------------------
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