eventreporter

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: AGPL-3.0 Imports: 9 Imported by: 2

README

Go Reference

eventreporter

The event reporter is a pluggable library for reporting on events.

License

GNU Affero General Public License v3.0 (GNU AGPLv3)
Copyright © 2021 Yale University

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailReporter

type EmailReporter struct {
	Address string
	Auth    smtp.Auth
	To      []string
	From    string
}

EmailReporter wraps up the configuration needed for sending email events

func NewEmailReporter

func NewEmailReporter(options map[string]string) (*EmailReporter, error)

NewEmailReporter takes a map of options and produces a reporter that can send email message events

func (*EmailReporter) Report

func (r *EmailReporter) Report(e Event) error

Report sends an email event

type Event

type Event struct {
	Message string
	Level   Level
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Level

type Level uint32
const (
	DEBUG Level = iota
	INFO
	WARN
	ERROR
)

type Reporter

type Reporter interface {
	Report(Event) error
}

func New

func New(name string, config map[string]string) (Reporter, error)

type SlackReporter

type SlackReporter struct {
	Endpoint string
	Token    string
	Channel  string
	Username string
	Icon     string
	Client   HTTPClient
}

func NewSlackReporter

func NewSlackReporter(options map[string]string) (*SlackReporter, error)

func (*SlackReporter) Report

func (r *SlackReporter) Report(e Event) error

Jump to

Keyboard shortcuts

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