Documentation
¶
Overview ¶
Package zuliprus provides a Slack hook for the logrus loggin package.
Index ¶
Constants ¶
View Source
const (
VERISON = "0.0.3"
)
Project version
Variables ¶
View Source
var AllLevels = []logrus.Level{ logrus.DebugLevel, logrus.InfoLevel, logrus.WarnLevel, logrus.ErrorLevel, logrus.FatalLevel, logrus.PanicLevel, }
Supported log levels
View Source
var LevelPrefixFn = func(e *logrus.Entry) string { color := "" switch e.Level { case logrus.DebugLevel: color = "```c++\nDEBUG\n```\n" case logrus.InfoLevel: color = "```bash\nINFO\n```\n" case logrus.ErrorLevel, logrus.FatalLevel, logrus.PanicLevel: color = "```terraform\nERROR\n```\n" default: color = "```apacheconf\nWARN\n```\n" } return color }
View Source
var MsgFmtFn = func(e *logrus.Entry) string { return fmt.Sprintf("%s> *%s* : %s", LevelPrefixFn(e), e.Time.Format("2006-01-02T15:04:05"), e.Message) }
Functions ¶
Types ¶
type FmtFunction ¶
type LevelPrefix ¶
type ZuliprusHook ¶
type ZuliprusHook struct {
// Messages with a log level not contained in this array
// will not be dispatched. If nil, all messages will be dispatched.
AcceptedLevels []logrus.Level
APIURL string
APIKey string
Email string
Stream string
UserEmails []string
Topic string
Asynchronous bool
Disabled bool
FormatFn FmtFunction
}
ZuliprusHook is a logrus Hook for dispatching messages to the specified channel on Slack.
func (*ZuliprusHook) Fire ¶
func (sh *ZuliprusHook) Fire(e *logrus.Entry) error
Fire - Send event to zulip
func (*ZuliprusHook) Levels ¶
func (sh *ZuliprusHook) Levels() []logrus.Level
Levels sets which levels to sent to slack
Click to show internal directories.
Click to hide internal directories.
