diff options
author | Rastislav Szabo <raszabo@cisco.com> | 2017-07-11 13:43:57 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2017-07-11 13:43:57 +0000 |
commit | 3ec4064566b9e4db1a88c007e0d9a513f7673b36 (patch) | |
tree | 35d0fb5b10013e85985ee876624b3581960a50b1 /core | |
parent | 0b6ef19a7de5b073b7818013930cc7f07526c929 (diff) | |
parent | 982b8703a757e5a91aa6451fd26593a065f8a452 (diff) |
Merge "added performance benchmark example"
Diffstat (limited to 'core')
-rw-r--r-- | core/request_handler.go | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/core/request_handler.go b/core/request_handler.go index f4f5e92..e0235b9 100644 --- a/core/request_handler.go +++ b/core/request_handler.go @@ -79,13 +79,15 @@ func (c *Connection) processRequest(ch *api.Channel, chMeta *channelMetadata, re return error } - // send the message - log.WithFields(logger.Fields{ - "context": chMeta.id, - "msg_id": msgID, - "msg_size": len(data), - }).Debug("Sending a message to VPP.") + if log.Level == logger.DebugLevel { // for performance reasons - logrus does some processing even if debugs are disabled + log.WithFields(logger.Fields{ + "context": chMeta.id, + "msg_id": msgID, + "msg_size": len(data), + }).Debug("Sending a message to VPP.") + } + // send the message if req.Multipart { // expect multipart response atomic.StoreUint32(&chMeta.multipart, 1) @@ -121,11 +123,13 @@ func msgCallback(context uint32, msgID uint16, data []byte) { return } - log.WithFields(logger.Fields{ - "context": context, - "msg_id": msgID, - "msg_size": len(data), - }).Debug("Received a message from VPP.") + if log.Level == logger.DebugLevel { // for performance reasons - logrus does some processing even if debugs are disabled + log.WithFields(logger.Fields{ + "context": context, + "msg_id": msgID, + "msg_size": len(data), + }).Debug("Received a message from VPP.") + } if context == 0 || conn.isNotificationMessage(msgID) { // process the message as a notification |