Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
Notifier provides a way to send notification/log events to both an externally accessible channel and to log framework.
func New ¶
func New(ch entity.NotifyChan, log *logger.Log, callerLevel int, sender, instance, stream string) *Notifier
New creates a new Notifier. For proper value on the caller func name, set `callerLevel` to:
1 - if the notifying func is immediately above the called Notify() 2 - if the notifying func is two levels above ... etc
func (*Notifier) Notify ¶
Notify sends the provided data to the provided channel (and optionally log framework), together with additional data depending on notification level:
DEBUG and INFO: name of calling func WARN: as INFO plus file and line number ERROR: as WARN plus the full stack trace.
func (*Notifier) SendNotificationEvent ¶
func (n *Notifier) SendNotificationEvent(notifyLevel int, event entity.NotificationEvent)
SendNotificationEvent takes a formatted NotificationEvent, enrich it with info such as func, file, line, call stack, and sends it to the channel.