alert

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 12 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{}) error
	Warn(f string, arg ...interface{}) error
	Error(f string, arg ...interface{}) error
	LimitWarn(max time.Duration, f string, arg ...interface{}) error
	LimitInfo(max time.Duration, f string, arg ...interface{}) error
	LimitError(max time.Duration, f string, arg ...interface{}) error
	LimitTagWarn(max time.Duration, tag string, f string, arg ...interface{}) error
	LimitTagInfo(max time.Duration, tag string, f string, arg ...interface{}) error
	LimitTagError(max time.Duration, tag string, f string, arg ...interface{}) error
}

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) (*GCloudAlerter, error)

NewGCloud instance

func (*GCloudAlerter) Error

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

Errorf implementation

func (*GCloudAlerter) Info

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

Info implementation

func (*GCloudAlerter) LimitError

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

LimitError implementation

func (*GCloudAlerter) LimitInfo

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

LimitInfo implementation

func (*GCloudAlerter) LimitTagError

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

LimitTagError implementation

func (*GCloudAlerter) LimitTagInfo

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

LimitTagInfo implementation

func (*GCloudAlerter) LimitTagWarn

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

LimitTagWarn implementation

func (*GCloudAlerter) LimitWarn

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

LimitWarn implementation

func (*GCloudAlerter) Warn

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

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

Error implementation

func (*LogrusAlerter) Info

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

Info implementation

func (*LogrusAlerter) LimitError

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

LimitError implementation

func (*LogrusAlerter) LimitInfo

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

LimitInfo implementation

func (*LogrusAlerter) LimitTagError

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

LimitTagError implementation

func (*LogrusAlerter) LimitTagInfo

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

LimitTagInfo implementation

func (*LogrusAlerter) LimitTagWarn

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

LimitTagWarn implementation

func (*LogrusAlerter) LimitWarn

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

LimitWarn implementation

func (*LogrusAlerter) Warn

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

Warn implementation

type Null

type Null struct {
}

Null is a blackhole

func (*Null) Error

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

Error implementation

func (*Null) Info

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

Info implementation

func (*Null) LimitError

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

LimitError implementation

func (*Null) LimitInfo

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

LimitInfo implementation

func (*Null) LimitTagError

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

LimitTagError implementation

func (*Null) LimitTagInfo

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

LimitTagInfo implementation

func (*Null) LimitTagWarn

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

LimitTagWarn implementation

func (*Null) LimitWarn

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

LimitWarn implementation

func (*Null) Warn

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

Warn implementation

Jump to

Keyboard shortcuts

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