Skip to content

Commit

Permalink
refactor: skip unwanted logs (#120)
Browse files Browse the repository at this point in the history
* feat: skip unwanted logs

* cl
  • Loading branch information
julienrbrt authored Dec 19, 2024
1 parent 6896d8e commit 58ab43b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [v1.1.1] - 2024-12-19

* [#120](https://github.com/cosmos/cosmos-db/pull/120) Skip unwanted logs from PebbleDB

## [v1.1.0] - 2024-11-22

* Allow full control in rocksdb opening
Expand Down
12 changes: 11 additions & 1 deletion pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ var _ DB = (*PebbleDB)(nil)

func NewPebbleDB(name string, dir string, opts Options) (DB, error) {
do := &pebble.Options{
Logger: &fatalLogger{}, // pebble info logs are messing up the logs (not a cosmossdk.io/log logger)
MaxConcurrentCompactions: func() int { return 3 }, // default 1
}

Expand All @@ -96,7 +97,6 @@ func NewPebbleDB(name string, dir string, opts Options) (DB, error) {

// Get implements DB.
func (db *PebbleDB) Get(key []byte) ([]byte, error) {
// fmt.Println("PebbleDB.Get")
if len(key) == 0 {
return nil, errKeyEmpty
}
Expand Down Expand Up @@ -492,3 +492,13 @@ func (itr *pebbleDBIterator) assertIsValid() {
panic("iterator is invalid")
}
}

type fatalLogger struct {
pebble.Logger
}

func (*fatalLogger) Fatalf(format string, args ...interface{}) {
pebble.DefaultLogger.Fatalf(format, args...)
}

func (*fatalLogger) Infof(format string, args ...interface{}) {}

Check failure on line 504 in pebble.go

View workflow job for this annotation

GitHub Actions / golangci

unused-parameter: parameter 'format' seems to be unused, consider removing or renaming it as _ (revive)

0 comments on commit 58ab43b

Please sign in to comment.