logging: remove reamining instances of SetLogger interface (#7572)

This commit is contained in:
Sam Kleinman
2022-01-12 16:56:49 -05:00
committed by GitHub
parent 7a9a38d9d7
commit 2a348cc1e9
21 changed files with 103 additions and 89 deletions
+9 -3
View File
@@ -76,7 +76,9 @@ func TestPersistentKVStoreKV(t *testing.T) {
if err != nil {
t.Fatal(err)
}
kvstore := NewPersistentKVStoreApplication(dir)
logger := log.NewTestingLogger(t)
kvstore := NewPersistentKVStoreApplication(logger, dir)
key := testKey
value := key
tx := []byte(key)
@@ -92,7 +94,9 @@ func TestPersistentKVStoreInfo(t *testing.T) {
if err != nil {
t.Fatal(err)
}
kvstore := NewPersistentKVStoreApplication(dir)
logger := log.NewTestingLogger(t)
kvstore := NewPersistentKVStoreApplication(logger, dir)
InitKVStore(kvstore)
height := int64(0)
@@ -124,7 +128,9 @@ func TestValUpdates(t *testing.T) {
if err != nil {
t.Fatal(err)
}
kvstore := NewPersistentKVStoreApplication(dir)
logger := log.NewTestingLogger(t)
kvstore := NewPersistentKVStoreApplication(logger, dir)
// init with some validators
total := 10
+2 -6
View File
@@ -35,7 +35,7 @@ type PersistentKVStoreApplication struct {
logger log.Logger
}
func NewPersistentKVStoreApplication(dbDir string) *PersistentKVStoreApplication {
func NewPersistentKVStoreApplication(logger log.Logger, dbDir string) *PersistentKVStoreApplication {
name := "kvstore"
db, err := dbm.NewGoLevelDB(name, dbDir)
if err != nil {
@@ -47,7 +47,7 @@ func NewPersistentKVStoreApplication(dbDir string) *PersistentKVStoreApplication
return &PersistentKVStoreApplication{
app: &Application{state: state},
valAddrToPubKeyMap: make(map[string]cryptoproto.PublicKey),
logger: log.NewNopLogger(),
logger: logger,
}
}
@@ -55,10 +55,6 @@ func (app *PersistentKVStoreApplication) Close() error {
return app.app.state.db.Close()
}
func (app *PersistentKVStoreApplication) SetLogger(l log.Logger) {
app.logger = l
}
func (app *PersistentKVStoreApplication) Info(req types.RequestInfo) types.ResponseInfo {
res := app.app.Info(req)
res.LastBlockHeight = app.app.state.Height