Documentation ¶
Index ¶
- Constants
- func Error(args ...interface{})
- func ErrorMD(lines []string)
- func Errorf(format string, a ...interface{})
- func Info(args ...interface{})
- func InfoMD(lines []string)
- func Infof(format string, a ...interface{})
- func SetDebug()
- func Warn(args ...interface{})
- func WarnMD(lines []string)
- func Warnf(format string, a ...interface{})
- type MsgMarkdown
- type MsgText
- type Noti
- func (n *Noti) Error(args ...interface{})
- func (n *Noti) ErrorMD(lines []string)
- func (n *Noti) Errorf(format string, a ...interface{})
- func (n *Noti) Info(args ...interface{})
- func (n *Noti) InfoMD(lines []string)
- func (n *Noti) Infof(format string, a ...interface{})
- func (n *Noti) SetDebug()
- func (n *Noti) SetLogger(logger *zap.SugaredLogger)
- func (n *Noti) Warn(args ...interface{})
- func (n *Noti) WarnMD(lines []string)
- func (n *Noti) Warnf(format string, a ...interface{})
- type RobotMsg
- type Sender
- type Settings
- type WeworkSender
- func (s WeworkSender) Error(args ...interface{}) error
- func (s WeworkSender) ErrorMD(lines []string) error
- func (s WeworkSender) Info(args ...interface{}) error
- func (s WeworkSender) InfoMD(lines []string) error
- func (s WeworkSender) Ready() bool
- func (s WeworkSender) SendRobotMarkdown(key string, lines []string) error
- func (s WeworkSender) SendRobotMsg(key, tp, content string) error
- func (s WeworkSender) Warn(args ...interface{}) error
- func (s WeworkSender) WarnMD(lines []string) error
Constants ¶
View Source
const (
ProviderWework = "wework"
)
All sender provider
Variables ¶
This section is empty.
Functions ¶
func Errorf ¶
func Errorf(format string, a ...interface{})
Errorf send default error notification with format
Types ¶
type MsgMarkdown ¶
type MsgMarkdown struct {
Content string `json:"content"`
}
MsgMarkdown is md message api model
type MsgText ¶
type MsgText struct {
Content string `json:"content"`
}
MsgText is text message api model
type Noti ¶
type Noti struct {
// contains filtered or unexported fields
}
Noti is noti instance
func (*Noti) SetLogger ¶
func (n *Noti) SetLogger(logger *zap.SugaredLogger)
SetLogger accept a custom zap sugared logger
type RobotMsg ¶
type RobotMsg struct { MsgType string `json:"msgtype"` Text *MsgText `json:"text,omitempty"` MarkDown *MsgMarkdown `json:"markdown,omitempty"` }
RobotMsg is message api model
type Sender ¶
type Sender interface { Info(args ...interface{}) error Warn(args ...interface{}) error Error(args ...interface{}) error InfoMD(lines []string) error WarnMD(lines []string) error ErrorMD(lines []string) error }
Sender interface
type Settings ¶
type Settings struct { NotiProvider string `default:"debug"` Wework WeworkSender }
Settings will be defined in New func or from Env
type WeworkSender ¶
type WeworkSender struct { BaseURL string `default:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="` InfoKey string WarnKey string ErrorKey string }
WeworkSender can send notification to wechat work.
func (WeworkSender) ErrorMD ¶
func (s WeworkSender) ErrorMD(lines []string) error
ErrorMD 出错通知 Markdown
func (WeworkSender) InfoMD ¶
func (s WeworkSender) InfoMD(lines []string) error
InfoMD 一般通知 Markdown
func (WeworkSender) Ready ¶
func (s WeworkSender) Ready() bool
Ready check if wechat work sender ready
func (WeworkSender) SendRobotMarkdown ¶
func (s WeworkSender) SendRobotMarkdown(key string, lines []string) error
SendRobotMarkdown 向机器人发送 Markdown 通知
func (WeworkSender) SendRobotMsg ¶
func (s WeworkSender) SendRobotMsg(key, tp, content string) error
SendRobotMsg send robot message by wechat work web api
func (WeworkSender) WarnMD ¶
func (s WeworkSender) WarnMD(lines []string) error
WarnMD 紧急通知 Markdown
Click to show internal directories.
Click to hide internal directories.