logger

package
v1.87.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 14 Imported by: 197

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

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

Errorf logs error message.

func ErrorfSkipframes added in v1.32.8

func ErrorfSkipframes(skipframes int, format string, args ...interface{})

ErrorfSkipframes logs error message and skips the given number of frames for the caller.

func Fatalf

func Fatalf(format string, args ...interface{})

Fatalf logs fatal message and terminates the app.

func Infof

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

Infof logs info message.

func Init

func Init()

Init initializes the logger.

Init must be called after flag.Parse()

There is no need in calling Init from tests.

func Panicf

func Panicf(format string, args ...interface{})

Panicf logs panic message and panics.

func ResetOutputForTest added in v1.87.0

func ResetOutputForTest()

ResetOutputForTest set logger output to default value

func SetOutputForTests added in v1.87.0

func SetOutputForTests(writer io.Writer)

SetOutputForTests redefine output for logger. Use for Tests only. Call ResetOutputForTest to return output state to default

func StdErrorLogger

func StdErrorLogger() *log.Logger

StdErrorLogger returns standard error logger.

func Warnf added in v1.34.9

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

Warnf logs warn message.

func WarnfSkipframes added in v1.34.9

func WarnfSkipframes(skipframes int, format string, args ...interface{})

WarnfSkipframes logs warn message and skips the given number of frames for the caller.

Types

type LogThrottler added in v1.72.0

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

LogThrottler is a logger, which throttles log messages passed to Warnf and Errorf.

LogThrottler must be created via WithThrottler() call.

func WithThrottler added in v1.72.0

func WithThrottler(name string, throttle time.Duration) *LogThrottler

WithThrottler returns a logger throttled by time - only one message in throttle duration will be logged.

New logger is created only once for each unique name passed. The function is thread-safe.

func (*LogThrottler) Errorf added in v1.72.0

func (lt *LogThrottler) Errorf(format string, args ...interface{})

Errorf logs error message.

func (*LogThrottler) Warnf added in v1.72.0

func (lt *LogThrottler) Warnf(format string, args ...interface{})

Warnf logs warn message.

Jump to

Keyboard shortcuts

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