Skip to content

Commit 855a9d0

Browse files
committed
[FAB-11852] use Fabric logger in orderer cluster
The cluster code was using the go-logging logger instead of the flogging.FabricLogger. Changed it accordingly. Change-Id: Idcb4f6a593baac78afb50bff5993545d98155356 Signed-off-by: yacovm <yacovm@il.ibm.com>
1 parent 8b18e2a commit 855a9d0

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

orderer/common/cluster/comm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
"time"
1515

1616
"github.com/golang/protobuf/proto"
17+
"github.com/hyperledger/fabric/common/flogging"
1718
"github.com/hyperledger/fabric/core/comm"
1819
"github.com/hyperledger/fabric/protos/orderer"
19-
"github.com/op/go-logging"
2020
"github.com/pkg/errors"
2121
)
2222

@@ -80,7 +80,7 @@ type MembersByChannel map[string]MemberMapping
8080
type Comm struct {
8181
shutdown bool
8282
Lock sync.RWMutex
83-
Logger *logging.Logger
83+
Logger *flogging.FabricLogger
8484
ChanExt ChannelExtractor
8585
H Handler
8686
Connections *ConnectionStore

orderer/common/cluster/comm_test.go

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

1818
"github.com/golang/protobuf/proto"
1919
"github.com/hyperledger/fabric/common/crypto/tlsgen"
20+
"github.com/hyperledger/fabric/common/flogging"
2021
comm_utils "github.com/hyperledger/fabric/core/comm"
2122
"github.com/hyperledger/fabric/orderer/common/cluster"
2223
"github.com/hyperledger/fabric/orderer/common/cluster/mocks"
2324
"github.com/hyperledger/fabric/protos/orderer"
2425
"github.com/onsi/gomega"
25-
"github.com/op/go-logging"
2626
"github.com/stretchr/testify/assert"
2727
"github.com/stretchr/testify/mock"
2828
"google.golang.org/grpc"
@@ -208,7 +208,7 @@ func newTestNode(t *testing.T) *clusterNode {
208208
}
209209

210210
tstSrv.c = &cluster.Comm{
211-
Logger: logging.MustGetLogger("test"),
211+
Logger: flogging.MustGetLogger("test"),
212212
Chan2Members: make(cluster.MembersByChannel),
213213
H: handler,
214214
ChanExt: channelExtractor,

orderer/common/cluster/service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"context"
1111
"io"
1212

13+
"github.com/hyperledger/fabric/common/flogging"
1314
"github.com/hyperledger/fabric/common/util"
1415
"github.com/hyperledger/fabric/protos/orderer"
15-
"github.com/op/go-logging"
1616
"google.golang.org/grpc"
1717
)
1818

@@ -37,7 +37,7 @@ type SubmitStream interface {
3737
// Service defines the raft Service
3838
type Service struct {
3939
Dispatcher Dispatcher
40-
Logger logging.Logger
40+
Logger *flogging.FabricLogger
4141
}
4242

4343
// Step forwards a message to a raft FSM located in this server

orderer/common/cluster/service_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"io"
1212
"testing"
1313

14+
"github.com/hyperledger/fabric/common/flogging"
1415
"github.com/hyperledger/fabric/core/comm"
1516
"github.com/hyperledger/fabric/orderer/common/cluster"
1617
"github.com/hyperledger/fabric/orderer/common/cluster/mocks"
@@ -34,6 +35,7 @@ func TestStep(t *testing.T) {
3435
dispatcher := &mocks.Dispatcher{}
3536

3637
svc := &cluster.Service{
38+
Logger: flogging.MustGetLogger("test"),
3739
Dispatcher: dispatcher,
3840
}
3941

@@ -78,6 +80,7 @@ func TestSubmitSuccess(t *testing.T) {
7880
})
7981

8082
svc := &cluster.Service{
83+
Logger: flogging.MustGetLogger("test"),
8184
Dispatcher: dispatcher,
8285
}
8386

@@ -155,6 +158,7 @@ func TestSubmitFailure(t *testing.T) {
155158
defer dispatcher.AssertNumberOfCalls(t, "DispatchSubmit", testCase.expectedDispatches)
156159
dispatcher.On("DispatchSubmit", mock.Anything, mock.Anything).Return(testCase.dispatchReturns...)
157160
svc := &cluster.Service{
161+
Logger: flogging.MustGetLogger("test"),
158162
Dispatcher: dispatcher,
159163
}
160164
err := svc.Submit(stream)
@@ -168,5 +172,7 @@ func TestServiceGRPC(t *testing.T) {
168172
// Check that Service correctly implements the gRPC interface
169173
srv, err := comm.NewGRPCServer("127.0.0.1:0", comm.ServerConfig{})
170174
assert.NoError(t, err)
171-
orderer.RegisterClusterServer(srv.Server(), &cluster.Service{})
175+
orderer.RegisterClusterServer(srv.Server(), &cluster.Service{
176+
Logger: flogging.MustGetLogger("test"),
177+
})
172178
}

0 commit comments

Comments
 (0)