alert

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NullAlerter is blackhole alerter
	NullAlerter = &Null{}
)

Functions

func OnGCE

func OnGCE() bool

OnGCE reports whether this process is running on Google Compute Engine

Types

type Alerter

type Alerter interface {
	Info(f string, arg ...interface{})
	Warn(f string, arg ...interface{})
	Error(f string, arg ...interface{})
	LimitWarn(max time.Duration, f string, arg ...interface{})
	LimitInfo(max time.Duration, f string, arg ...interface{})
	LimitError(max time.Duration, f string, arg ...interface{})
}

Alerter sends messages to the administrator

type GCloudAlerter

type GCloudAlerter struct {
	// contains filtered or unexported fields
}

GCloudAlerter sends alerts via Google Cloud Pub/Sub

func NewGCloud

func NewGCloud(origin string, logger *logrus.Entry) (*GCloudAlerter, func(), error)

NewGCloud instance

func (*GCloudAlerter) Error

func (a *GCloudAlerter) Error(f string, arg ...interface{})

Errorf implementation

func (*GCloudAlerter) Info

func (a *GCloudAlerter) Info(f string, arg ...interface{})

Info implementation

func (*GCloudAlerter) LimitError

func (a *GCloudAlerter) LimitError(max time.Duration, f string, arg ...interface{})

LimitError implementation

func (*GCloudAlerter) LimitInfo

func (a *GCloudAlerter) LimitInfo(max time.Duration, f string, arg ...interface{})

LimitInfo implementation

func (*GCloudAlerter) LimitWarn

func (a *GCloudAlerter) LimitWarn(max time.Duration, f string, arg ...interface{})

LimitWarn implementation

func (*GCloudAlerter) Warn

func (a *GCloudAlerter) Warn(f string, arg ...interface{})

Warn implementation

type LogrusAlerter

type LogrusAlerter struct {
	// contains filtered or unexported fields
}

LogrusAlerter sends alerts to logrus logger

func NewLogrus

func NewLogrus(logger *logrus.Entry) *LogrusAlerter

NewLogrus instance

func (*LogrusAlerter) Error

func (a *LogrusAlerter) Error(f string, arg ...interface{})

Error implementation

func (*LogrusAlerter) Info

func (a *LogrusAlerter) Info(f string, arg ...interface{})

Info implementation

func (*LogrusAlerter) LimitError

func (a *LogrusAlerter) LimitError(max time.Duration, f string, arg ...interface{})

LimitError implementation

func (*LogrusAlerter) LimitInfo

func (a *LogrusAlerter) LimitInfo(max time.Duration, f string, arg ...interface{})

LimitInfo implementation

func (*LogrusAlerter) LimitWarn

func (a *LogrusAlerter) LimitWarn(max time.Duration, f string, arg ...interface{})

LimitWarn implementation

func (*LogrusAlerter) Warn

func (a *LogrusAlerter) Warn(f string, arg ...interface{})

Warn implementation

type Null

type Null struct {
}

Null is a blackhole

func (*Null) Error

func (a *Null) Error(_ string, _ ...interface{})

Error implementation

func (*Null) Info

func (a *Null) Info(_ string, _ ...interface{})

Info implementation

func (*Null) LimitError

func (a *Null) LimitError(_ time.Duration, _ string, _ ...interface{})

LimitError implementation

func (*Null) LimitInfo

func (a *Null) LimitInfo(_ time.Duration, _ string, _ ...interface{})

LimitInfo implementation

func (*Null) LimitWarn

func (a *Null) LimitWarn(_ time.Duration, _ string, _ ...interface{})

LimitWarn implementation

func (*Null) Warn

func (a *Null) Warn(_ string, _ ...interface{})

Warn implementation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL