slack

package module
v0.0.0-...-3067844 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 15 Imported by: 0

README

slackerror

Documentation

Index

Constants

View Source
const (
	MAX_ERRORS         = 80
	NOTIFY_ERROR_COUNT = 10
)
View Source
const (
	Good    = "good"
	Warning = "warning"
	Danger  = "danger"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	AuthorName string   `json:"author_name,omitempty"`
	AuthorLink string   `json:"author_link,omitempty"`
	AuthorIcon string   `json:"author_icon,omitempty"`
	Colour     Colour   `json:"color,omitempty"` //// Can either be one of 'good', 'warning', 'danger', or any hex color code
	Fallback   string   `json:"fallback"`
	Fields     []*Field `json:"fields,omitempty"`
	Footer     string   `json:"footer,omitempty"`
	FooterIcon string   `json:"footer_icon,omitempty"`
	ImageURL   string   `json:"image_url,omitempty"`
	MarkdownIn []string `json:"mrkdwn_in,omitempty"` /// Can either be one of 'pretext', 'text' or 'fields'
	PreText    string   `json:"pretext,omitempty"`
	Text       string   `json:"text,omitempty"`
	Title      string   `json:"title,omitempty"`
	TitleLink  string   `json:"title_link,omitempty"`
	ThumbURL   string   `json:"thumb_url,omitempty"`
	Timestamp  uint64   `json:"ts,omitempty"`
}

type Colour

type Colour string

type Field

type Field struct {
	Title string `json:"title"`           // The title may not contain markup and will be escaped for you
	Value string `json:"value"`           // Text value of the field. May contain standard message markup and must be escaped as normal.  May be multi-line
	Short bool   `json:"short,omitempty"` // Optional flag indicating whether the `value` is short enough to be displayed side-by-side with other values
}

type FieldList

type FieldList []*Field

func (FieldList) Len

func (f FieldList) Len() int

func (FieldList) Less

func (f FieldList) Less(i, j int) bool

func (FieldList) Swap

func (f FieldList) Swap(i, j int)

type Message

type Message struct {
	Attachments []*Attachment `json:"attachments,omitempty"`
	Channel     string        `json:"channel,omitempty"`
	Markdown    bool          `json:"mrkdwn,omitempty"`
	Text        string        `json:"text,omitempty"`
	UserEmoji   string        `json:"icon_emoji,omitempty"`
	UserIcon    URL           `json:"icon_url,omitempty"`
	UserName    string        `json:"username,omitempty"`
}

type Non200ResponseError

type Non200ResponseError struct {
	Code int
	// contains filtered or unexported fields
}

func (*Non200ResponseError) Error

func (x *Non200ResponseError) Error() string

type SlackChannel

type SlackChannel struct {
	URL       URL // The URL returned by slack's webhook integration thing
	UserName  string
	UserIcon  URL
	UserEmoji string
	Channel   string
	// contains filtered or unexported fields
}

func (*SlackChannel) OnPanic

func (c *SlackChannel) OnPanic(hostname string)

func (*SlackChannel) Run

func (c *SlackChannel) Run()

func (*SlackChannel) SendAttachment

func (c *SlackChannel) SendAttachment(a *Attachment) (err error)

func (*SlackChannel) SendError

func (c *SlackChannel) SendError(errorToSend error, colour Colour, shortFields map[string]string, longFields map[string]string) (err error)

func (*SlackChannel) SendMessage

func (c *SlackChannel) SendMessage(messageToSend string, colour Colour, shortFields map[string]string, longFields map[string]string) (err error)

func (*SlackChannel) SendRawMessage

func (c *SlackChannel) SendRawMessage(m Message) (err error)

func (*SlackChannel) Shutdown

func (c *SlackChannel) Shutdown()

func (*SlackChannel) Warning

func (c *SlackChannel) Warning(format string, stuff ...interface{})

type SlogHandler

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

func NewSlogHandler

func NewSlogHandler(channel *SlackChannel, baseFields map[string]string) *SlogHandler

func (*SlogHandler) Enabled

func (h *SlogHandler) Enabled(_ context.Context, level slog.Level) bool

func (*SlogHandler) Handle

func (h *SlogHandler) Handle(_ context.Context, r slog.Record) error

func (*SlogHandler) WithAttrs

func (h *SlogHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*SlogHandler) WithGroup

func (h *SlogHandler) WithGroup(string) slog.Handler

type URL

type URL string

Jump to

Keyboard shortcuts

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