Documentation
¶
Overview ¶
Package rocketrus provides a RocketChat hook for the logrus loggin package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
NotRunningErr = fmt.Errorf("RocketrusHook doesn't running, please call Run function first")
)
Functions ¶
Types ¶
type RocketrusHook ¶
type RocketrusHook struct {
HookURL string
Channel string
// If UserID and Token are present, will use UserID and Token auth rocket.chat API
// otherwise Email and the Password are mandatory.
UserID string
Token string
Email string
Password string
// Messages with a log level not contained in this array
// will not be dispatched. If nil, all messages will be dispatched.
AcceptedLevels []logrus.Level
Disabled bool
// Title name for log
Title string
Alias string
Emoji string
Avatar string
// Notify users with @user in RocketChat.
NotifyUsers []string
// batch send message duration, uion/second, default is 10 seconds
// if duration is negative, RocketrusHook will block ticker message send
// e.g. Duration:10, Batch:8 means received more than(include equal) 8 logs in 10 seconds will send as one message to RocketChat immediately, or after 10 seconds received any(>=1) logs will send as one message to RocketChat.
// e.g. Duration:-1, Batch:8 means only received more than(include equal) 8 logs then send to RocketChat
Duration int64
// batch send message, default is 8
Batch int
*models.UserCredentials
*rest.Client
// contains filtered or unexported fields
}
RocketrusHook is a logrus Hook for dispatching messages to the specified channel on RocketChat.
func (*RocketrusHook) Fire ¶
func (rh *RocketrusHook) Fire(e *logrus.Entry) error
Fire - Sent event to RocketChat
func (*RocketrusHook) Levels ¶
func (rh *RocketrusHook) Levels() []logrus.Level
Levels sets which levels to sent to RocketChat
func (*RocketrusHook) Run ¶
func (rh *RocketrusHook) Run() error
Run start RocketrusHook message processor
Click to show internal directories.
Click to hide internal directories.