github.com/lulzWill/go-agent@v2.1.2+incompatible/log.go (about)

     1  package newrelic
     2  
     3  import (
     4  	"io"
     5  
     6  	"github.com/lulzWill/go-agent/internal/logger"
     7  )
     8  
     9  // Logger is the interface that is used for logging in the go-agent.  Assign the
    10  // Config.Logger field to the Logger you wish to use.  Loggers must be safe for
    11  // use in multiple goroutines.
    12  //
    13  // For an example implementation, see: _integrations/nrlogrus/nrlogrus.go
    14  type Logger interface {
    15  	Error(msg string, context map[string]interface{})
    16  	Warn(msg string, context map[string]interface{})
    17  	Info(msg string, context map[string]interface{})
    18  	Debug(msg string, context map[string]interface{})
    19  	DebugEnabled() bool
    20  }
    21  
    22  // NewLogger creates a basic Logger at info level.
    23  func NewLogger(w io.Writer) Logger {
    24  	return logger.New(w, false)
    25  }
    26  
    27  // NewDebugLogger creates a basic Logger at debug level.
    28  func NewDebugLogger(w io.Writer) Logger {
    29  	return logger.New(w, true)
    30  }