zippoxer / bow

Bow - Minimal embedded database powered by Badger
MIT License
224 stars 15 forks source link

Add convenience option function to set custom logger #11

Closed isbm closed 5 years ago

isbm commented 5 years ago

This adds a convenience function, same to SetCodec etc to set an alternative logger, such as logrus etc.

Currently it is possible this way:

path = "/tmp/foo"
options := badger.DefaultOptions(path)
options.Logger = logrus.New()
db, err = bow.Open(path, bow.SetBadgerOptions(options))
...

But also could be possible just this, if the case is to only swap quite verbose Badger's logging:

path = "/tmp/foo"
db, err := bow.Open(path, bow.SetLogger(logrus.New()))
zippoxer commented 5 years ago

That's neat. Thanks for contributing!