Skip to content

Commit 24ab51a

Browse files
committed
[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 <[email protected]>
1 parent dcac07e commit 24ab51a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

orderer/kafka/log.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ limitations under the License.
1717
package kafka
1818

1919
import (
20-
logging "github.com/op/go-logging"
20+
"github.com/hyperledger/fabric/common/flogging"
21+
"github.com/op/go-logging"
2122
)
2223

23-
var logger = logging.MustGetLogger("orderer/kafka")
24+
const pkgLogID = "orderer/kafka"
25+
26+
var logger *logging.Logger
27+
28+
func init() {
29+
logger = flogging.MustGetLogger(pkgLogID)
30+
}

orderer/kafka/log_test.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ limitations under the License.
1717
package kafka
1818

1919
import (
20-
logging "github.com/op/go-logging"
20+
"github.com/hyperledger/fabric/common/flogging"
2121
)
2222

2323
func init() {
24-
logging.SetLevel(logging.DEBUG, "") // Silence debug-level outputs when testing
24+
// This call allows us to (a) get the logging backend initialization that
25+
// takes place in the `flogging` package, and (b) adjust the verbosity of
26+
// the logs when running tests on this package.
27+
flogging.SetModuleLevel(pkgLogID, "ERROR")
2528
}

0 commit comments

Comments
 (0)