Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: modify interface to match comets #14904

Merged
merged 4 commits into from
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions log/go.mod
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions log/go.sum
Original file line number Diff line number Diff line change
@@ -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=
4 changes: 3 additions & 1 deletion log/logger.go
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 3 additions & 1 deletion log/noop_logger.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package log

import cmlog "github.com/cometbft/cometbft/libs/log"

var _ Logger = &NoOp{}

type NoOp struct{}
Expand All @@ -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
}