Documentation ¶
Index ¶
- func Errorf(format string, args ...any)
- func ErrorfSkipframes(skipframes int, format string, args ...any)
- func Fatalf(format string, args ...any)
- func Infof(format string, args ...any)
- func Init()
- func Panicf(format string, args ...any)
- func ResetOutputForTest()
- func SetOutputForTests(writer io.Writer)
- func StdErrorLogger() *log.Logger
- func Warnf(format string, args ...any)
- func WarnfSkipframes(skipframes int, format string, args ...any)
- type LogThrottler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorfSkipframes ¶ added in v1.32.8
ErrorfSkipframes logs error message and skips the given number of frames for the caller.
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 ResetOutputForTest ¶ added in v1.87.0
func ResetOutputForTest()
ResetOutputForTest set logger output to default value
func SetOutputForTests ¶ added in v1.87.0
SetOutputForTests redefine output for logger. Use for Tests only. Call ResetOutputForTest to return output state to default
func StdErrorLogger ¶
StdErrorLogger returns standard error logger.
func WarnfSkipframes ¶ added in v1.34.9
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 ...any)
Errorf logs error message.
func (*LogThrottler) Warnf ¶ added in v1.72.0
func (lt *LogThrottler) Warnf(format string, args ...any)
Warnf logs warn message.