From 9e84136ee560c627c1079bfcb9489e90bb205ba2 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Wed, 29 Jul 2015 15:13:22 +1000 Subject: [PATCH] Don't run sprintf when unnecessary. --- connection.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connection.go b/connection.go index fd1fb56..4f3decc 100644 --- a/connection.go +++ b/connection.go @@ -391,7 +391,9 @@ func (c *Connection) ReadOp() (ctx context.Context, op interface{}, err error) { } // Choose an ID for this operation for the purposes of logging, and log it. - c.debugLog(inMsg.Header().Unique, 1, "<- %s", describeRequest(op)) + if c.debugLogger != nil { + c.debugLog(inMsg.Header().Unique, 1, "<- %s", describeRequest(op)) + } // Special case: handle interrupt requests inline. if interruptOp, ok := op.(*interruptOp); ok {