kslack

package
v0.0.0-...-131b606 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package kslack

Package kslack

Package kslack

Package kslack

Index

Constants

View Source
const (
	ColorDanger  string = "danger"
	ColorWarning string = "warning"
	ColorGood    string = "good"
)

Variables

View Source
var (
	MySQLDbErrs []ErrorConfig = []ErrorConfig{
		{},
	}
	MemSQLDbErrs []ErrorConfig = []ErrorConfig{
		{},
	}
	MgoDbErrs []ErrorConfig = []ErrorConfig{
		{},
	}
	RedisDbErrs []ErrorConfig = []ErrorConfig{
		{},
	}
)

Functions

func NewSlackNotifyConfig

func NewSlackNotifyConfig(pattern string, repeatCount int, level int, notifyTarget ...string) *slackNotifyConfig

func SlackInstance

func SlackInstance() *slacker

Types

type ErrorConfig

type ErrorConfig struct {
	Pattern string
	Min     int
	// contains filtered or unexported fields
}

type Hook

type Hook struct {
	ServiceName string
	AuthorName  string
	Channel     string
	IconURL     string
	IconEmoji   string

	ErrorConfigs []ErrorConfig
	// contains filtered or unexported fields
}

func NewHook

func NewHook(serviceName string, configs ...ErrorConfig) *Hook

func (*Hook) Fire

func (hook *Hook) Fire(sourceEntry *logrus.Entry) error

func (*Hook) Levels

func (hook *Hook) Levels() []logrus.Level

type NotifyConfig

type NotifyConfig struct {
	Pattern      string `json:"pattern"`
	NotifyLevel  SlackNotifyLevel
	NotifyTarget SlackNotifyTarget
	Min          int `json:"min"`
	Max          int `json:"max"`
}

type Report

type Report struct {
	Key    string
	Title  string        `json:"title"`
	Fields []ReportField `json:"fields"`
}

type ReportField

type ReportField struct {
	Title string      `json:"title"`
	Data  interface{} `json:"data"`
}

type SlackNotifyLevel

type SlackNotifyLevel int
const (
	NotifyUser    SlackNotifyLevel = 1
	NotifyChannel SlackNotifyLevel = 2
)

type SlackNotifyTarget

type SlackNotifyTarget string

type SlackRunMode

type SlackRunMode int

region Object

const (
	DebugMode      SlackRunMode = 1
	DevelopMode    SlackRunMode = 2
	ProductionMode SlackRunMode = 3
)

type Slacker

type Slacker interface {
	CustomMsg(ops ...slack.MsgOption) error
	Report(report Report) error
}

Jump to

Keyboard shortcuts

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