Documentation
¶
Index ¶
- func ErrorInheritf(err error, msg string, f ...interface{}) error
- func ErrorPermf(msg string, f ...interface{}) error
- func ErrorTempf(msg string, f ...interface{}) error
- func IsErrorTemporary(err error) bool
- func LoggerHeader(l Source) string
- func RetryForever(ctx context.Context, p RetryParams) (err error)
- type Common
- type Error
- type Logger
- func (l *Logger) Debugf(m string, f ...interface{})
- func (l *Logger) Errorf(m string, f ...interface{})
- func (l *Logger) LogDebugEv(uuid string, m string, f ...interface{})
- func (l *Logger) LogEv(uuid string, m string, f ...interface{})
- func (l *Logger) LogVerboseEv(uuid string, m string, f ...interface{})
- func (l *Logger) Logf(m string, f ...interface{})
- func (l *Logger) SetDebug(d bool)
- func (l *Logger) SetVerbose(d bool)
- type RetryParams
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorInheritf ¶
ErrorInheritf creates a new error. It tries to set the permanent flag based on the provided error.
func ErrorPermf ¶
ErrorPermf returns permanent error
func ErrorTempf ¶
ErrorTempf returns temporary error
func IsErrorTemporary ¶
IsErrorTemporary tries to guess if an error is temporary or fatal If unsure - report as temporary
func LoggerHeader ¶
LoggerHeader returns a log header for a particular source
func RetryForever ¶
func RetryForever(ctx context.Context, p RetryParams) (err error)
RetryForever executes the provided function F() from RetryParams until succeeded It logs to logger, increments error counter and reports to prometheus (if any of these were provided)
Types ¶
type Common ¶
type Common interface { Name() string Type() string Stats() string Status() error Close() error SetDebug(bool) SetVerbose(bool) }
Common is a common set of functions embedded by sinks & sources
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a common error type with permanent flag
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is embedded by sinks & sources structs
func LoggerCreate ¶
LoggerCreate creates a logger
func (*Logger) LogDebugEv ¶
LogDebugEv logs event if debug
func (*Logger) LogVerboseEv ¶
LogVerboseEv logs event if verbose
type RetryParams ¶
type RetryParams struct { F func() error Interval time.Duration Logger *Logger // errorMsg should have %d and %s placeholders for retry count and error ErrorMsg string ErrorCounter *uint64 PromErrorCounter prometheus.Counter RetryPermanentError bool }
RetryParams are params for RetryForever