Skip to content

Commit a51d4bd

Browse files
committed
[grpc logger] add a flogging wrapper to easily disable the GRPC logger
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
1 parent 9558b56 commit a51d4bd

52 files changed

Lines changed: 277 additions & 143 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ help:
5252
## Builds all tools
5353
tools: $(TOOLS_EXES)
5454

55-
GO_TEST_FMT_FLAGS := -hide empty-packages
55+
go_test_cmd=gotestsum --rerun-fails=0 --format dots -- -v -timeout 30m ./...
5656

57-
## Run all tests
57+
## Run all tests.
5858
test: FORCE
59-
@$(go_test) ./... | gotestfmt ${GO_TEST_FMT_FLAGS}
59+
@$(go_test_cmd) -race
6060

6161
# Runs test with coverage analysis.
6262
test-cover: FORCE
63-
@$(go_test) -coverprofile=coverage.profile -coverpkg=./... ./... | gotestfmt ${GO_TEST_FMT_FLAGS}
63+
@$(go_test_cmd) -coverprofile=coverage.profile
6464
@scripts/test-coverage-filter-files.sh
6565

6666
cover-report: FORCE

cmd/configtxgen/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import (
1515

1616
"github.com/hyperledger/fabric-lib-go/bccsp/factory"
1717

18+
"github.com/hyperledger/fabric-x-common/common/flogging"
1819
"github.com/hyperledger/fabric-x-common/common/metadata"
19-
"github.com/hyperledger/fabric-x-common/common/util"
2020
"github.com/hyperledger/fabric-x-common/tools/configtxgen"
2121
)
2222

23-
var logger = util.MustGetLogger("common.tools.configtxgen")
23+
var logger = flogging.MustGetLogger("common.tools.configtxgen")
2424

2525
const programName = "configtxgen"
2626

cmd/configtxlator/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import (
2727
"google.golang.org/protobuf/reflect/protoreflect"
2828
"google.golang.org/protobuf/reflect/protoregistry"
2929

30+
"github.com/hyperledger/fabric-x-common/common/flogging"
3031
"github.com/hyperledger/fabric-x-common/common/metadata"
31-
"github.com/hyperledger/fabric-x-common/common/util"
3232
"github.com/hyperledger/fabric-x-common/protolator"
3333
"github.com/hyperledger/fabric-x-common/tools/configtxlator/rest"
3434
"github.com/hyperledger/fabric-x-common/tools/configtxlator/update"
@@ -69,7 +69,7 @@ var (
6969
versionCmd = app.Command("version", "Show version information")
7070
)
7171

72-
var logger = util.MustGetLogger("configtxlator")
72+
var logger = flogging.MustGetLogger("configtxlator")
7373

7474
func main() {
7575
kingpin.Version("0.0.1")

common/capabilities/capabilities.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
1111
"github.com/pkg/errors"
1212

13-
"github.com/hyperledger/fabric-x-common/common/util"
13+
"github.com/hyperledger/fabric-x-common/common/flogging"
1414
)
1515

16-
var logger = util.MustGetLogger("common.capabilities")
16+
var logger = flogging.MustGetLogger("common.capabilities")
1717

1818
// provider is the 'plugin' parameter for registry.
1919
type provider interface {

common/cauthdsl/cauthdsl.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import (
1515
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
1616
"go.uber.org/zap/zapcore"
1717

18-
"github.com/hyperledger/fabric-x-common/common/util"
18+
"github.com/hyperledger/fabric-x-common/common/flogging"
1919
"github.com/hyperledger/fabric-x-common/msp"
2020
)
2121

22-
var cauthdslLogger = util.MustGetLogger("cauthdsl")
22+
var cauthdslLogger = flogging.MustGetLogger("cauthdsl")
2323

2424
// compile recursively builds a go evaluatable function corresponding to the policy specified, remember to call deduplicate on identities before
2525
// passing them to this function for evaluation

common/channelconfig/bundle.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import (
1313

1414
"github.com/hyperledger/fabric-x-common/common/cauthdsl"
1515
"github.com/hyperledger/fabric-x-common/common/configtx"
16+
"github.com/hyperledger/fabric-x-common/common/flogging"
1617
"github.com/hyperledger/fabric-x-common/common/policies"
17-
"github.com/hyperledger/fabric-x-common/common/util"
1818
"github.com/hyperledger/fabric-x-common/msp"
1919
"github.com/hyperledger/fabric-x-common/protoutil"
2020
)
2121

22-
var logger = util.MustGetLogger("common.channelconfig")
22+
var logger = flogging.MustGetLogger("common.channelconfig")
2323

2424
// RootGroupKey is the key for namespacing the channel config, especially for
2525
// policy evaluation.

common/configtx/test/helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import (
1212
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
1313

1414
"github.com/hyperledger/fabric-x-common/common/channelconfig"
15+
"github.com/hyperledger/fabric-x-common/common/flogging"
1516
"github.com/hyperledger/fabric-x-common/common/genesis"
16-
"github.com/hyperledger/fabric-x-common/common/util"
1717
"github.com/hyperledger/fabric-x-common/core/config/configtest"
1818
"github.com/hyperledger/fabric-x-common/protoutil"
1919
"github.com/hyperledger/fabric-x-common/tools/configtxgen"
2020
"github.com/hyperledger/fabric-x-common/tools/pkg/txflags"
2121
)
2222

23-
var logger = util.MustGetLogger("common.configtx.test")
23+
var logger = flogging.MustGetLogger("common.configtx.test")
2424

2525
// MakeGenesisBlock creates a genesis block using the test templates for the given channelID
2626
func MakeGenesisBlock(channelID string) (*cb.Block, error) {

common/configtx/validator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import (
1313
"github.com/pkg/errors"
1414
"google.golang.org/protobuf/proto"
1515

16+
"github.com/hyperledger/fabric-x-common/common/flogging"
1617
"github.com/hyperledger/fabric-x-common/common/policies"
17-
"github.com/hyperledger/fabric-x-common/common/util"
1818
"github.com/hyperledger/fabric-x-common/protoutil"
1919
)
2020

21-
var logger = util.MustGetLogger("common.configtx")
21+
var logger = flogging.MustGetLogger("common.configtx")
2222

2323
// Constraints for valid channel and config IDs
2424
var (

common/deliver/deliver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ import (
2121
"google.golang.org/protobuf/proto"
2222

2323
"github.com/hyperledger/fabric-x-common/common/crypto"
24+
"github.com/hyperledger/fabric-x-common/common/flogging"
2425
"github.com/hyperledger/fabric-x-common/common/ledger/blockledger"
2526
"github.com/hyperledger/fabric-x-common/common/policies"
2627
"github.com/hyperledger/fabric-x-common/common/util"
2728
"github.com/hyperledger/fabric-x-common/protoutil"
2829
)
2930

30-
var logger = util.MustGetLogger("common.deliver")
31+
var logger = flogging.MustGetLogger("common.deliver")
3132

3233
//go:generate counterfeiter -o mock/chain_manager.go -fake-name ChainManager . ChainManager
3334

common/deliverclient/block_verification.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111
"encoding/hex"
1212

1313
"github.com/hyperledger/fabric-lib-go/bccsp"
14-
"github.com/hyperledger/fabric-lib-go/common/flogging"
1514
"github.com/hyperledger/fabric-protos-go-apiv2/common"
1615
"github.com/pkg/errors"
1716

1817
"github.com/hyperledger/fabric-x-common/common/configtx"
18+
"github.com/hyperledger/fabric-x-common/common/flogging"
1919
"github.com/hyperledger/fabric-x-common/protoutil"
2020
)
2121

0 commit comments

Comments
 (0)