aboutsummaryrefslogtreecommitdiffstats
path: root/core/request_handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/request_handler.go')
-rw-r--r--core/request_handler.go26
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