RocketChat hook for Logrus.
package main
import (
"log"
"time"
"github.com/miraclesu/rocketrus"
"github.com/sirupsen/logrus"
)
func main() {
hook := &rocketrus.RocketrusHook{
HookURL: "http://localhost:3000",
Channel: "general",
NotifyUsers: []string{"miracle", "yuhcwl"},
AcceptedLevels: rocketrus.LevelThreshold(logrus.DebugLevel),
Email: "[email protected]",
Password: "gopher",
Duration: -1,
Batch: 1,
}
if err := hook.Run(); err != nil {
log.Fatalln(err.Error())
}
logrus.AddHook(hook)
logrus.SetLevel(logrus.DebugLevel)
logrus.Warn("warn")
logrus.Info("info")
logrus.Debug("debug")
time.Sleep(1 * time.Second)
}
- HookURL
- Channel
- UserID & Token or Email & Password
- AcceptedLevels
- Disabled
- Title
- Alias
- Emoji
- Avatar
- NotifyUsers
- Duration
- Batch
go get github.com/miraclesu/rocketrus