Documentation ¶
Index ¶
- func Errorf(format string, args ...interface{})
- func ErrorfSkipframes(skipframes int, format string, args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Infof(format string, args ...interface{})
- func Init()
- func Panicf(format string, args ...interface{})
- func ResetOutputForTest()
- func SetOutputForTests(writer io.Writer)
- func StdErrorLogger() *log.Logger
- func Warnf(format string, args ...interface{})
- func WarnfSkipframes(skipframes int, format string, args ...interface{})
- 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 Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf logs fatal message and terminates the app.
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 Warnf ¶ added in v1.34.9
func Warnf(format string, args ...interface{})
Warnf logs warn message.
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 ...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.