Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Default error tolerance config DefaultETConfig ErrorToleranceConfig // Default error tolerance logger DefaultETLogger *ErrorTolerantLogger )
Functions ¶
func AddDingTalkAlertHook ¶
AddDingTalkAlertHook adds logrus hook for DingTalk alert with specified log levels.
func MustInitFromViper ¶
func MustInitFromViper()
MustInitFromViper inits logging from viper settings and adapts Geth logger.
Note that viper must be initilized before this, and it will panic and exit if any error happens.
Types ¶
type DingTalkAlertHook ¶
type DingTalkAlertHook struct {
// contains filtered or unexported fields
}
DingTalkAlertHook logrus hooks to send specified level logs as text message to DingTalk group chat.
func NewDingTalkAlertHook ¶
func NewDingTalkAlertHook(lvls []logrus.Level) *DingTalkAlertHook
NewDingTalkAlertHook constructor to new DingTalkAlertHook instance.
func (*DingTalkAlertHook) Fire ¶
func (hook *DingTalkAlertHook) Fire(logEntry *logrus.Entry) error
Fire implements logrus.Hook interface `Fire` method.
func (*DingTalkAlertHook) Levels ¶
func (hook *DingTalkAlertHook) Levels() []logrus.Level
Levels implements logrus.Hook interface `Levels` method.
type ErrorToleranceConfig ¶ added in v0.2.0
type ErrorToleranceConfig struct { ReportFailures uint64 `default:"60"` RemindFailures uint64 `default:"60"` }
ErrorToleranceConfig defines the configuration for error tolerance behavior.
type ErrorTolerantLogger ¶ added in v0.2.0
type ErrorTolerantLogger struct {
// contains filtered or unexported fields
}
ErrorTolerantLogger is a thread-safe logger with error tolerance behavior based on the continuous error count.
func MustNewErrorTolerantLoggerFromViper ¶ added in v0.2.0
func MustNewErrorTolerantLoggerFromViper() *ErrorTolerantLogger
func NewErrorTolerantLogger ¶ added in v0.2.0
func NewErrorTolerantLogger(conf ErrorToleranceConfig) *ErrorTolerantLogger
func (*ErrorTolerantLogger) Log ¶ added in v0.2.0
func (etl *ErrorTolerantLogger) Log(l logrus.FieldLogger, err error, msg string)
Log logs the error message with appropriate level based on the continuous error count.
func (*ErrorTolerantLogger) Logf ¶ added in v0.2.0
func (etl *ErrorTolerantLogger) Logf(l logrus.FieldLogger, err error, msg string, args ...interface{})
type LoggingConfig ¶
LoggingConfig logging configuration such as log level etc.,