github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/storage/util/logger.go (about)

     1  package util
     2  
     3  import (
     4  	"github.com/rs/zerolog"
     5  )
     6  
     7  // Logger implements a logger satisfying Badger's Logger interface.
     8  type Logger struct {
     9  	log zerolog.Logger
    10  }
    11  
    12  func NewLogger(logger zerolog.Logger) *Logger {
    13  	return &Logger{
    14  		log: logger.With().Str("component", "badger").Logger(),
    15  	}
    16  }
    17  
    18  func (l *Logger) Errorf(msg string, args ...interface{}) {
    19  	l.log.Error().Msgf(msg, args...)
    20  }
    21  
    22  func (l *Logger) Warningf(msg string, args ...interface{}) {
    23  	l.log.Warn().Msgf(msg, args...)
    24  }
    25  
    26  func (l *Logger) Infof(msg string, args ...interface{}) {
    27  	l.log.Info().Msgf(msg, args...)
    28  }
    29  
    30  func (l *Logger) Debugf(msg string, args ...interface{}) {
    31  	l.log.Debug().Msgf(msg, args...)
    32  }