Skip to content

Commit 58ab43b

Browse files
authored
refactor: skip unwanted logs (#120)
* feat: skip unwanted logs * cl
1 parent 6896d8e commit 58ab43b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [v1.1.1] - 2024-12-19
4+
5+
* [#120](https://github.com/cosmos/cosmos-db/pull/120) Skip unwanted logs from PebbleDB
6+
37
## [v1.1.0] - 2024-11-22
48

59
* Allow full control in rocksdb opening

pebble.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ var _ DB = (*PebbleDB)(nil)
7272

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

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

9798
// Get implements DB.
9899
func (db *PebbleDB) Get(key []byte) ([]byte, error) {
99-
// fmt.Println("PebbleDB.Get")
100100
if len(key) == 0 {
101101
return nil, errKeyEmpty
102102
}
@@ -492,3 +492,13 @@ func (itr *pebbleDBIterator) assertIsValid() {
492492
panic("iterator is invalid")
493493
}
494494
}
495+
496+
type fatalLogger struct {
497+
pebble.Logger
498+
}
499+
500+
func (*fatalLogger) Fatalf(format string, args ...interface{}) {
501+
pebble.DefaultLogger.Fatalf(format, args...)
502+
}
503+
504+
func (*fatalLogger) Infof(format string, args ...interface{}) {}

0 commit comments

Comments
 (0)