From 24ab51af481c09c8fbf46fca59d5e182f83f8803 Mon Sep 17 00:00:00 2001
From: Kostas Christidis <kostas@christidis.io>
Date: Mon, 27 Mar 2017 21:45:51 -0400
Subject: [PATCH] [FAB-2917] Use flogging-init'd logger

https://jira.hyperledger.org/browse/FAB-2917

This changeset:

1. Uses the newly-introduced `MustGetLogger` call from the `flogging`
package in place of the same call from the `go-logging` package.
2. Allows the tests on the kafka package to log their output
to a flogging-initialized logger.

Change-Id: Icc5741bbb04e28242374548cb78c5f5d5075b8b7
Signed-off-by: Kostas Christidis <kostas@christidis.io>
---
 orderer/kafka/log.go      | 11 +++++++++--
 orderer/kafka/log_test.go |  7 +++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/orderer/kafka/log.go b/orderer/kafka/log.go
index d88ee2586ca..eaf3927a193 100644
--- a/orderer/kafka/log.go
+++ b/orderer/kafka/log.go
@@ -17,7 +17,14 @@ limitations under the License.
 package kafka
 
 import (
-	logging "github.com/op/go-logging"
+	"github.com/hyperledger/fabric/common/flogging"
+	"github.com/op/go-logging"
 )
 
-var logger = logging.MustGetLogger("orderer/kafka")
+const pkgLogID = "orderer/kafka"
+
+var logger *logging.Logger
+
+func init() {
+	logger = flogging.MustGetLogger(pkgLogID)
+}
diff --git a/orderer/kafka/log_test.go b/orderer/kafka/log_test.go
index 58c36270e88..c9a3e1b6608 100644
--- a/orderer/kafka/log_test.go
+++ b/orderer/kafka/log_test.go
@@ -17,9 +17,12 @@ limitations under the License.
 package kafka
 
 import (
-	logging "github.com/op/go-logging"
+	"github.com/hyperledger/fabric/common/flogging"
 )
 
 func init() {
-	logging.SetLevel(logging.DEBUG, "") // Silence debug-level outputs when testing
+	// This call allows us to (a) get the logging backend initialization that
+	// takes place in the `flogging` package, and (b) adjust the verbosity of
+	// the logs when running tests on this package.
+	flogging.SetModuleLevel(pkgLogID, "ERROR")
 }