Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
/ cosmos-sdk Public archive
forked from cosmos/cosmos-sdk

Commit

Permalink
refactor: modify interface to match comets (cosmos#14904)
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle authored and tsenart committed Apr 12, 2023
1 parent 66321b2 commit db7fa00
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
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
}

0 comments on commit db7fa00

Please sign in to comment.