Skip to content

Commit

Permalink
zero: Add 'Entry' to Logrus no-ops
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Xie committed Oct 11, 2019
1 parent 9ac2e2e commit 98c9149
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions zero/logger.go → zero/logrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ import (
// Logger returns a no-op logrus.Logger.
func Logger() *logrus.Logger { return noopLogger }

var noopLogger *logrus.Logger
// Entry returns a no-op logrus.Entry.
func Entry() *logrus.Entry { return noopEntry }

// Initialize noopLogger.
var (
noopLogger *logrus.Logger
noopEntry *logrus.Entry
)

// Initialize noopLogger, noopEntry.
func init() {
noopLogger = logrus.New()
noopLogger.SetLevel(logrus.PanicLevel)
noopLogger.SetOutput(ioutil.Discard)

noopEntry = logrus.NewEntry(noopLogger)
}
File renamed without changes.

0 comments on commit 98c9149

Please sign in to comment.