xraylog

package
v1.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
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
)

func (LogLevel) String

func (ll LogLevel) String() string

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

func NewDefaultLogger(w io.Writer, minLogLevel LogLevel) Logger

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL