You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/05/14 16:33:43 UTC
[pulsar-client-go] 06/38: Set right level for logs
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git
commit d31030ecc8373ba80ff33f03a13d8a54fdf7f880
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Sat Mar 30 11:37:23 2019 -0700
Set right level for logs
---
pulsar/impl/connection.go | 4 ++--
pulsar/impl/lookup_service.go | 6 +++---
pulsar/impl_partition_producer.go | 9 +++++----
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/pulsar/impl/connection.go b/pulsar/impl/connection.go
index 2bd2984..2f09690 100644
--- a/pulsar/impl/connection.go
+++ b/pulsar/impl/connection.go
@@ -99,7 +99,7 @@ func (c *connection) connect() (ok bool) {
return false
} else {
c.log = c.log.WithField("laddr", c.cnx.LocalAddr())
- c.log.Info("TCP connection established")
+ c.log.Debug("TCP connection established")
c.state = connectionTcpConnected
return true
}
@@ -198,7 +198,7 @@ func (c *connection) writeCommand(cmd proto.Message) {
}
func (c *connection) receivedCommand(cmd *pb.BaseCommand, headersAndPayload []byte) {
- c.log.Infof("Received command: %s -- payload: %v", cmd, headersAndPayload)
+ c.log.Debugf("Received command: %s -- payload: %v", cmd, headersAndPayload)
c.lastDataReceivedTime = time.Now()
switch *cmd.Type {
diff --git a/pulsar/impl/lookup_service.go b/pulsar/impl/lookup_service.go
index afd0dda..e3753d9 100644
--- a/pulsar/impl/lookup_service.go
+++ b/pulsar/impl/lookup_service.go
@@ -44,17 +44,17 @@ func (ls *lookupService) Lookup(topic string) (*LookupResult, error) {
return nil, err
}
- log.Infof("Got lookup response: %s", res)
+ log.WithField("topic", topic).Debugf("Got topic lookup response: %s", res)
lr := res.Response.LookupTopicResponse
switch *lr.Response {
case pb.CommandLookupTopicResponse_Redirect:
// TODO: Handle redirects
- log.WithField("topic", topic).Infof("Follow redirect to broker. %v / %v - Use proxy: %v",
+ log.WithField("topic", topic).Debugf("Follow redirect to broker. %v / %v - Use proxy: %v",
lr.BrokerServiceUrl, lr.BrokerServiceUrlTls, lr.ProxyThroughServiceUrl)
break
case pb.CommandLookupTopicResponse_Connect:
- log.WithField("topic", topic).Infof("Successfully looked up topic on broker. %s / %s - Use proxy: %t",
+ log.WithField("topic", topic).Debugf("Successfully looked up topic on broker. %s / %s - Use proxy: %t",
lr.GetBrokerServiceUrl(), lr.GetBrokerServiceUrlTls(), lr.GetProxyThroughServiceUrl())
logicalAddress, err := url.Parse(lr.GetBrokerServiceUrl())
diff --git a/pulsar/impl_partition_producer.go b/pulsar/impl_partition_producer.go
index 4ba5506..7bb2165 100644
--- a/pulsar/impl_partition_producer.go
+++ b/pulsar/impl_partition_producer.go
@@ -42,7 +42,8 @@ func newPartitionProducer(client *client, topic string, options *ProducerOptions
log.WithError(err).Errorf("Failed to create producer")
return nil, err
} else {
- log.Info("Created producer on cnx: ")
+ p.log = p.log.WithField("name", *p.producerName)
+ p.log.Info("Created producer")
go p.run()
return p, nil
}
@@ -55,7 +56,7 @@ func (p *partitionProducer) grabCnx() error {
return err
}
- p.log.Info("Lookup result: ", lr)
+ p.log.Debug("Lookup result: ", lr)
id := p.client.rpcClient.NewRequestId()
res, err := p.client.rpcClient.Request(lr.LogicalAddr, lr.PhysicalAddr, id, pb.BaseCommand_PRODUCER, &pb.CommandProducer{
RequestId: &id,
@@ -74,7 +75,7 @@ func (p *partitionProducer) grabCnx() error {
p.producerName = res.Response.ProducerSuccess.ProducerName
p.cnx = res.Cnx
- p.log.WithField("cnx", res.Cnx).Info("Created producer")
+ p.log.WithField("cnx", res.Cnx).Debug("Connected producer")
return nil
}
@@ -83,7 +84,7 @@ func (p *partitionProducer) run() {
i := <-p.eventsChan
switch v := i.(type) {
case *sendRequest:
- p.log.Info("Received send request: ", v)
+ p.log.Debug("Received send request: ", v)
v.callback(nil, v.msg, nil)
}
}