log

package
v0.52.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoopLogger = noopLogger{}

NoopLogger is a logger which has no effect upon calling.

Functions

func Critical

func Critical(v ...interface{})

Critical formats message using the default formats for its operands and writes to log with level = Critical

func Criticalf

func Criticalf(format string, params ...interface{})

Criticalf formats message according to format specifier and writes to log with level = Critical.

func Debug

func Debug(v ...interface{})

Debug formats message using the default formats for its operands and writes to log with level = Debug

func Debugf

func Debugf(format string, params ...interface{})

Debugf formats message according to format specifier and writes to log with level = Debug.

func Error

func Error(v ...interface{})

Error formats message using the default formats for its operands and writes to log with level = Error

func Errorf

func Errorf(format string, params ...interface{})

Errorf formats message according to format specifier and writes to log with level = Error.

func Flush

func Flush()

Flush flushes all the messages in the logger.

func Info

func Info(v ...interface{})

Info formats message using the default formats for its operands and writes to log with level = Info

func Infof

func Infof(format string, params ...interface{})

Infof formats message according to format specifier and writes to log with level = Info.

func IsSet added in v0.44.0

func IsSet() bool

IsSet returns whether the logger has been set up.

func Trace

func Trace(v ...interface{})

Trace formats message using the default formats for its operands and writes to log with level = Trace

func Tracef

func Tracef(format string, params ...interface{})

Tracef formats message according to format specifier and writes to log with level = Trace.

func Warn

func Warn(v ...interface{})

Warn formats message using the default formats for its operands and writes to log with level = Warn

func Warnf

func Warnf(format string, params ...interface{})

Warnf formats message according to format specifier and writes to log with level = Warn.

Types

type Logger

type Logger interface {
	Trace(v ...interface{})
	Tracef(format string, params ...interface{})
	Debug(v ...interface{})
	Debugf(format string, params ...interface{})
	Info(v ...interface{})
	Infof(format string, params ...interface{})
	Warn(v ...interface{}) error
	Warnf(format string, params ...interface{}) error
	Error(v ...interface{}) error
	Errorf(format string, params ...interface{}) error
	Critical(v ...interface{}) error
	Criticalf(format string, params ...interface{}) error
	Flush()
}

Logger implements the core logger interface.

func SetLogger

func SetLogger(l Logger) Logger

SetLogger sets l as the default Logger and returns the old logger.

type ThrottledLogger

type ThrottledLogger struct {
	// contains filtered or unexported fields
}

ThrottledLogger limits the number of log calls during a time window. To create a new logger use NewThrottled.

func NewThrottled

func NewThrottled(n int, d time.Duration) *ThrottledLogger

NewThrottled returns a new throttled logger. The returned logger will allow up to n calls in a time period of length d.

func (*ThrottledLogger) Error

func (tl *ThrottledLogger) Error(format string, params ...interface{})

Error logs the message at the error level.

func (*ThrottledLogger) Warn

func (tl *ThrottledLogger) Warn(format string, params ...interface{})

Warn logs the message at the warning level.

func (*ThrottledLogger) Write

func (tl *ThrottledLogger) Write(p []byte) (n int, err error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

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