Skip to content

Commit

Permalink
[FAB-2917] Use flogging-init'd logger
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kchristidis committed Mar 31, 2017
1 parent dcac07e commit 24ab51a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 9 additions & 2 deletions orderer/kafka/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
7 changes: 5 additions & 2 deletions orderer/kafka/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 24ab51a

Please sign in to comment.