From a2b75a1a9bb0bb0035e5b160f80b78cf7a2bdd90 Mon Sep 17 00:00:00 2001 From: James Houlahan Date: Fri, 12 Aug 2022 12:57:26 +0200 Subject: [PATCH] chore: Remove dead logging code Setting the badger logger option after already setting the level overwrites the changed level, so this commit just removes the unused option. We will inherit the level of the logrus standard logger anyway. --- store/badger.go | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/store/badger.go b/store/badger.go index 7edc824c..61b4b3a0 100644 --- a/store/badger.go +++ b/store/badger.go @@ -15,34 +15,12 @@ type BadgerStore struct { wg sync.WaitGroup } -func logrusLevelToBadgerLevel(options badger.Options) badger.Options { - switch logrus.GetLevel() { - case logrus.InfoLevel: - return options.WithLoggingLevel(badger.INFO) - case logrus.TraceLevel: - fallthrough - case logrus.DebugLevel: - return options.WithLoggingLevel(badger.DEBUG) - case logrus.WarnLevel: - return options.WithLoggingLevel(badger.WARNING) - case logrus.FatalLevel: - fallthrough - case logrus.PanicLevel: - fallthrough - case logrus.ErrorLevel: - return options.WithLoggingLevel(badger.ERROR) - default: - return options.WithLoggingLevel(badger.ERROR) - } -} - func NewBadgerStore(path string, userID string, encryptionPassphrase []byte) (*BadgerStore, error) { - directory := filepath.Join(path, userID) - db, err := badger.Open(logrusLevelToBadgerLevel(badger.DefaultOptions(directory)). + db, err := badger.Open(badger.DefaultOptions(filepath.Join(path, userID)). WithLogger(logrus.StandardLogger()). WithEncryptionKey(encryptionPassphrase). - WithIndexCacheSize(128 * 1024 * 1024)) - + WithIndexCacheSize(128 * 1024 * 1024), + ) if err != nil { return nil, nil }