Documentation ¶
Index ¶
Constants ¶
const DefaultPrefix = "instana: "
DefaultPrefix is the default log prefix used by Logger
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level uint8
Level defines the minimum logging level for logger.Log
Valid log levels to be used with (*logger.Logger).SetLevel()
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a configurable leveled logger used by Instana's Go sensor. It follows the same interface as github.com/sirupsen/logrus.Logger and go.uber.org/zap.SugaredLogger
func New ¶
New initializes a new instance of Logger that uses provided printer as a backend to output the log messages. The stdlib log.Logger satisfies logger.Printer interface:
logger := logger.New(logger.WarnLevel, log.New(os.Stderr, "instana:", log.LstdFlags)) logger.SetLevel(logger.WarnLevel) logger.Debug("this is a debug message") // won't be printed logger.Error("this is an message") // ... while this one will
In case there is no printer provided, logger.Logger will use a new instance of log.Logger initialized with log.Lstdflags that writes to os.Stderr:
log.New(os.Stderr, "", log.Lstdflags)
The default logging level for a new logger instance is logger.ErrorLevel.
func (*Logger) Debug ¶
func (l *Logger) Debug(v ...interface{})
Debug appends a debug message to the log
func (*Logger) Error ¶
func (l *Logger) Error(v ...interface{})
Error appends an error message to the log
func (*Logger) Info ¶
func (l *Logger) Info(v ...interface{})
Info appends an info message to the log
func (*Logger) SetLevel ¶
SetLevel changes the log level for this logger instance. In case there is an INSTANA_DEBUG env variable set, the provided log level will be overridden with DebugLevel.