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 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 ¶
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 StdErrorLogger ¶
StdErrorLogger returns standard error logger.
func WarnfSkipframes ¶
WarnfSkipframes logs warn message and skips the given number of frames for the caller.
Types ¶
type LogThrottler ¶
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 ¶
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 ¶
func (lt *LogThrottler) Errorf(format string, args ...interface{})
Errorf logs error message.
func (*LogThrottler) Warnf ¶
func (lt *LogThrottler) Warnf(format string, args ...interface{})
Warnf logs warn message.