notify

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func (n *Notifier) Notify(level int, message string, args ...any)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL