Skip to content

Commit

Permalink
Remove logger name conversion
Browse files Browse the repository at this point in the history
Callers must now provide dot qualified names

FAB-12768 #done

Change-Id: I0c9e63f292d19bf898d4e1ab499219d76cdcda43
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm committed Nov 7, 2018
1 parent be90d3c commit ce5bd2c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 17 deletions.
2 changes: 0 additions & 2 deletions common/flogging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package flogging
import (
"io"
"os"
"strings"
"sync"

"github.com/hyperledger/fabric/common/flogging/fabenc"
Expand Down Expand Up @@ -188,7 +187,6 @@ func (s *Logging) Encoding() Encoding {
// enabled.
func (s *Logging) ZapLogger(module string) *zap.Logger {
s.mutex.RLock()
module = strings.Replace(module, "/", ".", -1)
levelEnabler := zap.LevelEnablerFunc(func(l zapcore.Level) bool {
// always return true here because the core's Check()
// method computes the level for the logger name based
Expand Down
13 changes: 0 additions & 13 deletions common/flogging/logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,6 @@ func TestLoggingSetWriter(t *testing.T) {
assert.EqualError(t, err, "welp")
}

func TestZapLoggerNameConversion(t *testing.T) {
logging, err := flogging.New(flogging.Config{
LogSpec: "fatal:test=debug",
})
assert.NoError(t, err)

assert.Equal(t, zapcore.FatalLevel, logging.Level("test/module/name"))
assert.Equal(t, zapcore.DebugLevel, logging.Level("test.module.name"))

logger := logging.Logger("test/module/name")
assert.True(t, logger.IsEnabledFor(zapcore.DebugLevel))
}

func TestNamedLogger(t *testing.T) {
defer flogging.Reset()
buf := &bytes.Buffer{}
Expand Down
2 changes: 1 addition & 1 deletion orderer/common/cluster/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func BlockPullerFromConfigBlock(conf PullerConfig, block *common.Block) (*BlockP
}

return &BlockPuller{
Logger: flogging.MustGetLogger("orderer/common/cluster/replication"),
Logger: flogging.MustGetLogger("orderer.common.cluster.replication"),
Dialer: dialer,
TLSCert: tlsCertAsDER.Bytes,
VerifyBlockSequence: func(blocks []*common.Block) error {
Expand Down
2 changes: 1 addition & 1 deletion token/client/tx_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/pkg/errors"
)

var logger = flogging.MustGetLogger("token/client")
var logger = flogging.MustGetLogger("token.client")

type TxSubmitter struct {
Config *ClientConfig
Expand Down

0 comments on commit ce5bd2c

Please sign in to comment.