Skip to content

Commit ef2e48c

Browse files
committed
Tune gossip/comm logging levels
There are a few log messages in gossip/comm that might better be logged as debug instead of info. Change-Id: Id6f8a513753cd199e3a21189d344f87f84d45372 Signed-off-by: Yacov Manevich <[email protected]>
1 parent eab249d commit ef2e48c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

gossip/comm/comm_impl.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (c *commImpl) Send(msg *proto.GossipMessage, peers ...*RemotePeer) {
216216
return
217217
}
218218

219-
c.logger.Info("Entering, sending", msg, "to ", len(peers), "peers")
219+
c.logger.Debug("Entering, sending", msg, "to ", len(peers), "peers")
220220

221221
for _, peer := range peers {
222222
go func(peer *RemotePeer, msg *proto.GossipMessage) {
@@ -333,7 +333,7 @@ func (c *commImpl) PresumedDead() <-chan common.PKIidType {
333333
}
334334

335335
func (c *commImpl) CloseConn(peer *RemotePeer) {
336-
c.logger.Info("Closing connection for", peer)
336+
c.logger.Debug("Closing connection for", peer)
337337
c.connStore.closeConn(peer)
338338
}
339339

@@ -464,7 +464,7 @@ func (c *commImpl) GossipStream(stream proto.Gossip_GossipStreamServer) error {
464464
c.logger.Error("Authentication failed")
465465
return err
466466
}
467-
c.logger.Info("Servicing", extractRemoteAddress(stream))
467+
c.logger.Debug("Servicing", extractRemoteAddress(stream))
468468

469469
conn := c.connStore.onConnected(stream, PKIID)
470470

@@ -485,7 +485,7 @@ func (c *commImpl) GossipStream(stream proto.Gossip_GossipStreamServer) error {
485485
conn.handler = h
486486

487487
defer func() {
488-
c.logger.Info("Client", extractRemoteAddress(stream), " disconnected")
488+
c.logger.Debug("Client", extractRemoteAddress(stream), " disconnected")
489489
c.connStore.closeByPKIid(PKIID)
490490
conn.close()
491491
}()

gossip/comm/conn.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package comm
1818

1919
import (
20-
"fmt"
20+
"errors"
2121
"sync"
2222
"sync/atomic"
2323

@@ -60,7 +60,7 @@ func (cs *connectionStore) getConnection(peer *RemotePeer) (*connection, error)
6060
cs.RUnlock()
6161

6262
if isClosing {
63-
return nil, fmt.Errorf("Shutting down")
63+
return nil, errors.New("Shutting down")
6464
}
6565

6666
pkiID := peer.PKIID
@@ -90,7 +90,7 @@ func (cs *connectionStore) getConnection(peer *RemotePeer) (*connection, error)
9090
destinationLock.Unlock()
9191

9292
if cs.isClosing {
93-
return nil, fmt.Errorf("ConnStore is closing")
93+
return nil, errors.New("ConnStore is closing")
9494
}
9595

9696
cs.Lock()
@@ -273,7 +273,7 @@ func (conn *connection) serviceConnection() error {
273273
for !conn.toDie() {
274274
select {
275275
case stop := <-conn.stopChan:
276-
conn.logger.Warning("Closing reading from stream")
276+
conn.logger.Debug("Closing reading from stream")
277277
conn.stopChan <- stop
278278
return nil
279279
case err := <-errChan:
@@ -301,7 +301,7 @@ func (conn *connection) writeToStream() {
301301
}
302302
break
303303
case stop := <-conn.stopChan:
304-
conn.logger.Warning("Closing writing to stream")
304+
conn.logger.Debug("Closing writing to stream")
305305
conn.stopChan <- stop
306306
return
307307
}
@@ -316,17 +316,17 @@ func (conn *connection) readFromStream(errChan chan error, msgChan chan *proto.G
316316
stream := conn.getStream()
317317
if stream == nil {
318318
conn.logger.Error(conn.pkiID, "Stream is nil, aborting!")
319-
errChan <- fmt.Errorf("Stream is nil")
319+
errChan <- errors.New("Stream is nil")
320320
return
321321
}
322322
msg, err := stream.Recv()
323323
if conn.toDie() {
324-
conn.logger.Warning(conn.pkiID, "canceling read because closing")
324+
conn.logger.Debug(conn.pkiID, "canceling read because closing")
325325
return
326326
}
327327
if err != nil {
328328
errChan <- err
329-
conn.logger.Warning(conn.pkiID, "Got error, aborting:", err)
329+
conn.logger.Debug(conn.pkiID, "Got error, aborting:", err)
330330
return
331331
}
332332
msgChan <- msg

0 commit comments

Comments
 (0)