refactor: modify interface to match comets (#14904)

This commit is contained in:
Marko 2023-02-04 12:04:49 +01:00 committed by GitHub
parent bcbe6e835f
commit 7c50238af0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 2 deletions

View File

@ -1,3 +1,11 @@
module github.com/cosmos/cosmos-sdk/log
go 1.19
require github.com/cometbft/cometbft v0.0.0-20230202201700-d159562d0d96
require (
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
)

12
log/go.sum Normal file
View File

@ -0,0 +1,12 @@
github.com/cometbft/cometbft v0.0.0-20230202201700-d159562d0d96 h1:IRiCr0VpGdF5uIokdeUOdleG1zCIfuAtmCSgdvp1Ay0=
github.com/cometbft/cometbft v0.0.0-20230202201700-d159562d0d96/go.mod h1:OzbxTW/3VRke0yIK8OmfVcRlF7cDkk0nu0XM/aw72FI=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@ -1,10 +1,12 @@
package log
import cmlog "github.com/cometbft/cometbft/libs/log"
// Logger is the interface that wraps the basic logging methods.
type Logger interface {
Debug(msg string, keyvals ...interface{})
Info(msg string, keyvals ...interface{})
Error(msg string, keyvals ...interface{})
With(keyvals ...interface{}) Logger
With(keyvals ...interface{}) cmlog.Logger
}

View File

@ -1,5 +1,7 @@
package log
import cmlog "github.com/cometbft/cometbft/libs/log"
var _ Logger = &NoOp{}
type NoOp struct{}
@ -12,6 +14,6 @@ func (l NoOp) Debug(msg string, keyvals ...interface{}) {}
func (l NoOp) Info(msg string, keyvals ...interface{}) {}
func (l NoOp) Error(msg string, keyvals ...interface{}) {}
func (l NoOp) With(i ...interface{}) Logger {
func (l NoOp) With(i ...interface{}) cmlog.Logger {
return l
}