Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NullLogger = nullLogger{}
NullLogger can be used to disable logging (pass to xray.SetLogger()).
Functions ¶
This section is empty.
Types ¶
type LogLevel ¶
type LogLevel int
LogLevel represents the severity of a log message, where a higher value means more severe. The integer value should not be serialized as it is subject to change.
const ( // LogLevelDebug is usually only enabled when debugging. LogLevelDebug LogLevel = iota + 1 // LogLevelInfo is general operational entries about what's going on inside the application. LogLevelInfo // LogLevelWarn is non-critical entries that deserve eyes. LogLevelWarn // LogLevelError is used for errors that should definitely be noted. LogLevelError )
type Logger ¶
type Logger interface { // Log can be called concurrently from multiple goroutines so make sure // your implementation is goroutine safe. Log(level LogLevel, msg fmt.Stringer) }
Logger is the logging interface used by xray. fmt.Stringer is used to defer expensive serialization operations until the message is actually logged (i.e. don't bother serializing debug messages if they aren't going to show up).
func NewDefaultLogger ¶
NewDefaultLogger makes a Logger object that writes newline separated messages to w, if the level of the message is at least minLogLevel. The default logger synchronizes around Write() calls to the underlying io.Writer.