Commit 2512861e authored by Kostas Christidis's avatar Kostas Christidis
Browse files

[FAB-6108] Make logging package names consistent



See JIRA for more info.

Change-Id: I4dd0d48b7548820fa096a1c4f4f72ad9dcdb48ee
Signed-off-by: default avatarKostas Christidis <kostas@christidis.io>
parent bd23071d
......@@ -10,10 +10,17 @@ import (
"github.com/hyperledger/fabric/common/channelconfig"
cb "github.com/hyperledger/fabric/protos/common"
"github.com/hyperledger/fabric/common/flogging"
"github.com/op/go-logging"
)
var logger = logging.MustGetLogger("orderer/common/blockcutter")
const pkgLogID = "orderer/common/blockcutter"
var logger *logging.Logger
func init() {
logger = flogging.MustGetLogger(pkgLogID)
}
// Receiver defines a sink for the ordered broadcast messages
type Receiver interface {
......
......@@ -23,12 +23,12 @@ import (
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
logging "github.com/op/go-logging"
"github.com/hyperledger/fabric/common/flogging"
"github.com/stretchr/testify/assert"
)
func init() {
logging.SetLevel(logging.DEBUG, "")
flogging.SetModuleLevel(pkgLogID, "DEBUG")
}
var tx = &cb.Envelope{Payload: []byte("GOOD")}
......
......@@ -9,6 +9,7 @@ package broadcast
import (
"io"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/orderer/common/msgprocessor"
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
......@@ -18,7 +19,13 @@ import (
"github.com/pkg/errors"
)
var logger = logging.MustGetLogger("orderer/common/broadcast")
const pkgLogID = "orderer/common/broadcast"
var logger *logging.Logger
func init() {
logger = flogging.MustGetLogger(pkgLogID)
}
// Handler defines an interface which handles broadcasts
type Handler interface {
......@@ -113,9 +120,7 @@ func (bh *handlerImpl) Handle(srv ab.AtomicBroadcast_BroadcastServer) error {
}
}
if logger.IsEnabledFor(logging.DEBUG) {
logger.Debugf("[channel: %s] Broadcast has successfully enqueued message of type %s from %s", chdr.ChannelId, cb.HeaderType_name[chdr.Type], addr)
}
logger.Debugf("[channel: %s] Broadcast has successfully enqueued message of type %s from %s", chdr.ChannelId, cb.HeaderType_name[chdr.Type], addr)
err = srv.Send(&ab.BroadcastResponse{Status: cb.Status_SUCCESS})
if err != nil {
......
......@@ -12,10 +12,10 @@ import (
"testing"
"time"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/orderer/common/msgprocessor"
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
logging "github.com/op/go-logging"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
......@@ -24,7 +24,7 @@ import (
)
func init() {
logging.SetLevel(logging.DEBUG, "")
flogging.SetModuleLevel(pkgLogID, "DEBUG")
}
type mockStream struct {
......
......@@ -19,6 +19,7 @@ package deliver
import (
"io"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/common/policies"
"github.com/hyperledger/fabric/orderer/common/ledger"
"github.com/hyperledger/fabric/orderer/common/msgprocessor"
......@@ -31,7 +32,13 @@ import (
"github.com/hyperledger/fabric/protos/utils"
)
var logger = logging.MustGetLogger("orderer/common/deliver")
const pkgLogID = "orderer/common/deliver"
var logger *logging.Logger
func init() {
logger = flogging.MustGetLogger(pkgLogID)
}
// Handler defines an interface which handles Deliver requests
type Handler interface {
......
......@@ -22,6 +22,7 @@ import (
"testing"
"time"
"github.com/hyperledger/fabric/common/flogging"
mockpolicies "github.com/hyperledger/fabric/common/mocks/policies"
"github.com/hyperledger/fabric/common/policies"
"github.com/hyperledger/fabric/common/tools/configtxgen/provisional"
......@@ -30,7 +31,6 @@ import (
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
"github.com/hyperledger/fabric/protos/utils"
logging "github.com/op/go-logging"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
"google.golang.org/grpc"
......@@ -44,7 +44,7 @@ var systemChainID = "systemChain"
const ledgerSize = 10
func init() {
logging.SetLevel(logging.DEBUG, "")
flogging.SetModuleLevel(pkgLogID, "DEBUG")
}
type mockStream struct {
......
......@@ -17,6 +17,7 @@ limitations under the License.
package fileledger
import (
"github.com/hyperledger/fabric/common/flogging"
cl "github.com/hyperledger/fabric/common/ledger"
"github.com/hyperledger/fabric/common/ledger/blkstorage"
ledger "github.com/hyperledger/fabric/orderer/common/ledger"
......@@ -25,10 +26,14 @@ import (
"github.com/op/go-logging"
)
var logger = logging.MustGetLogger("orderer/fileledger")
const pkgLogID = "orderer/ledger/fileledger"
var logger *logging.Logger
var closedChan chan struct{}
func init() {
logger = flogging.MustGetLogger(pkgLogID)
closedChan = make(chan struct{})
close(closedChan)
}
......
......@@ -23,13 +23,13 @@ import (
"os"
"testing"
"github.com/hyperledger/fabric/common/flogging"
cl "github.com/hyperledger/fabric/common/ledger"
"github.com/hyperledger/fabric/common/tools/configtxgen/provisional"
"github.com/hyperledger/fabric/orderer/common/ledger"
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
"github.com/hyperledger/fabric/protos/peer"
logging "github.com/op/go-logging"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
......@@ -37,7 +37,7 @@ import (
var genesisBlock = cb.NewBlock(0, nil)
func init() {
logging.SetLevel(logging.DEBUG, "")
flogging.SetModuleLevel(pkgLogID, "DEBUG")
}
type testEnv struct {
......
......@@ -23,6 +23,7 @@ import (
"path/filepath"
"sync"
"github.com/hyperledger/fabric/common/flogging"
ledger "github.com/hyperledger/fabric/orderer/common/ledger"
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
......@@ -31,11 +32,14 @@ import (
"github.com/golang/protobuf/jsonpb"
)
var logger = logging.MustGetLogger("orderer/jsonledger")
const pkgLogID = "orderer/ledger/jsonledger"
var logger *logging.Logger
var closedChan chan struct{}
var fileLock sync.Mutex
func init() {
logger = flogging.MustGetLogger(pkgLogID)
closedChan = make(chan struct{})
close(closedChan)
}
......
......@@ -22,19 +22,19 @@ import (
"testing"
"time"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/common/tools/configtxgen/provisional"
"github.com/hyperledger/fabric/orderer/common/ledger"
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
logging "github.com/op/go-logging"
"github.com/stretchr/testify/assert"
)
var genesisBlock = cb.NewBlock(0, nil)
func init() {
logging.SetLevel(logging.DEBUG, "")
flogging.SetModuleLevel(pkgLogID, "DEBUG")
}
type testEnv struct {
......
......@@ -20,13 +20,20 @@ import (
"bytes"
"fmt"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/orderer/common/ledger"
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
"github.com/op/go-logging"
)
var logger = logging.MustGetLogger("orderer/ramledger")
const pkgLogID = "orderer/ledger/ramledger"
var logger *logging.Logger
func init() {
logger = flogging.MustGetLogger(pkgLogID)
}
type cursor struct {
list *simpleList
......
......@@ -19,18 +19,17 @@ package ramledger
import (
"testing"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/common/tools/configtxgen/provisional"
"github.com/hyperledger/fabric/orderer/common/ledger"
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
logging "github.com/op/go-logging"
)
var genesisBlock = cb.NewBlock(0, nil)
func init() {
logging.SetLevel(logging.DEBUG, "")
flogging.SetModuleLevel(pkgLogID, "DEBUG")
}
func newTestChain(maxSize int) *ramLedger {
......
......@@ -36,7 +36,7 @@ import (
)
const (
pkgLogID = "orderer/common/localconfig"
pkgLogID = "orderer/common/config"
// Prefix identifies the prefix for the orderer-related ENV vars.
Prefix = "ORDERER"
......@@ -50,7 +50,7 @@ var (
func init() {
logger = flogging.MustGetLogger(pkgLogID)
flogging.SetModuleLevel(pkgLogID, "error")
flogging.SetModuleLevel(pkgLogID, "ERROR")
configName = strings.ToLower(Prefix)
}
......
......@@ -24,10 +24,15 @@ import (
"testing"
"time"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/common/tools/configtxgen/provisional"
"github.com/stretchr/testify/assert"
)
func init() {
flogging.SetModuleLevel(pkgLogID, "DEBUG")
}
func TestGoodConfig(t *testing.T) {
assert.NotNil(t, Load(), "Could not load config")
}
......
......@@ -13,16 +13,23 @@ import (
"github.com/hyperledger/fabric/common/flogging"
cb "github.com/hyperledger/fabric/protos/common"
logging "github.com/op/go-logging"
)
var logger = flogging.MustGetLogger("common/msgprocessor")
const (
pkgLogID = "orderer/common/msgprocessor"
// These should eventually be derived from the channel support once enabled
msgVersion = int32(0)
epoch = 0
)
var logger *logging.Logger
func init() {
logger = flogging.MustGetLogger(pkgLogID)
}
// ErrChannelDoesNotExist is returned by the system channel for transactions which
// are not for the system channel ID and are not attempting to create a new channel
var ErrChannelDoesNotExist = errors.New("channel does not exist")
......
......@@ -10,17 +10,17 @@ import (
"fmt"
"testing"
"github.com/hyperledger/fabric/common/flogging"
mockpolicies "github.com/hyperledger/fabric/common/mocks/policies"
cb "github.com/hyperledger/fabric/protos/common"
"github.com/hyperledger/fabric/protos/utils"
"github.com/op/go-logging"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)
func init() {
logging.SetLevel(logging.DEBUG, "")
flogging.SetModuleLevel(pkgLogID, "DEBUG")
}
func makeEnvelope() *cb.Envelope {
......
......@@ -15,6 +15,7 @@ import (
"github.com/hyperledger/fabric/common/channelconfig"
"github.com/hyperledger/fabric/common/configtx"
configtxapi "github.com/hyperledger/fabric/common/configtx/api"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/orderer/common/ledger"
"github.com/hyperledger/fabric/orderer/common/msgprocessor"
"github.com/hyperledger/fabric/orderer/consensus"
......@@ -26,13 +27,19 @@ import (
"github.com/hyperledger/fabric/common/crypto"
)
var logger = logging.MustGetLogger("orderer/multichannel")
const (
pkgLogID = "orderer/commmon/multichannel"
msgVersion = int32(0)
epoch = 0
)
var logger *logging.Logger
func init() {
logger = flogging.MustGetLogger(pkgLogID)
}
type mutableResources interface {
channelconfig.Resources
Update(*channelconfig.Bundle)
......
......@@ -14,6 +14,7 @@ import (
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/common/channelconfig"
"github.com/hyperledger/fabric/common/crypto"
"github.com/hyperledger/fabric/common/flogging"
mockcrypto "github.com/hyperledger/fabric/common/mocks/crypto"
genesisconfig "github.com/hyperledger/fabric/common/tools/configtxgen/localconfig"
"github.com/hyperledger/fabric/common/tools/configtxgen/provisional"
......@@ -26,7 +27,6 @@ import (
"github.com/hyperledger/fabric/protos/utils"
mmsp "github.com/hyperledger/fabric/common/mocks/msp"
logging "github.com/op/go-logging"
"github.com/stretchr/testify/assert"
)
......@@ -37,7 +37,7 @@ var mockSigningIdentity msp.SigningIdentity
const NoConsortiumChain = "no-consortium-chain"
func init() {
logging.SetLevel(logging.DEBUG, "")
flogging.SetModuleLevel(pkgLogID, "DEBUG")
mockSigningIdentity, _ = mmsp.NewNoopMsp().GetDefaultSigningIdentity()
conf = genesisconfig.Load(genesisconfig.SampleInsecureProfile)
......
......@@ -10,6 +10,7 @@ import (
"io"
"sync"
"github.com/hyperledger/fabric/common/flogging"
cb "github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/protos/orderer"
"github.com/op/go-logging"
......@@ -18,7 +19,13 @@ import (
"google.golang.org/grpc/peer"
)
var logger = logging.MustGetLogger("orderer/performance")
const pkgLogID = "orderer/common/performance"
var logger *logging.Logger
func init() {
logger = flogging.MustGetLogger(pkgLogID)
}
// BenchmarkServer is a pseudo-server that grpc services could be registered to
type BenchmarkServer struct {
......
......@@ -24,7 +24,8 @@ import (
)
const (
Kilo = 1024 // TODO(jay_guo) consider adding an unit pkg
// Kilo allows us to convert byte units to kB.
Kilo = 1024 // TODO Consider adding a unit pkg
)
var conf *config.TopLevel
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment