EventBus

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AllLogsTopic = RoutingKeyBase + "*"
View Source
const DebugLogsTopic = RoutingKeyBase + "debug.*"
View Source
const ErrorLogsTopic = RoutingKeyBase + "error.*"
View Source
const InfoLogsTopic = RoutingKeyBase + "info.*"
View Source
const RoutingKeyBase = "type.log.level."
View Source
const WarnLogsTopic = RoutingKeyBase + "warn.*"

Variables

This section is empty.

Functions

func FileLogSubscriber added in v1.3.0

func FileLogSubscriber(file *os.File) (events.Subscriber, error)

func IOLogSubscriber added in v1.3.0

func IOLogSubscriber(w io.Writer) (events.Subscriber, error)

IOLogSubscriber creates an eventbus subscriber that writes all logs from the eventbus to the IO Writer w. the events.Subscriber returned from this function is for advanced usage and can be safely ignored in 99% of use cases.

Example:

_, err := IOLogSubscriber(ioWriter)
if err != nil {
  // failed to create the log subscriber
}

// continue with application functions

func InitLogger added in v1.3.0

func InitLogger(logLevel string, encoding logs.Encoding, options ...zap.Option) (*zap.Logger, error)

func New

func New()

func Publish

func Publish(routingKey string, event any) error

func SplitStdoutStderrLogSubscriber added in v1.3.0

func SplitStdoutStderrLogSubscriber() ([]events.Subscriber, error)

func StderrLogSubscriber added in v1.3.0

func StderrLogSubscriber() (events.Subscriber, error)

func StdoutLogSubscriber added in v1.3.0

func StdoutLogSubscriber() (events.Subscriber, error)

func Stop

func Stop()

func Subscribe

func Subscribe(topic string) (events.Subscriber, error)

func Unsubscribe

func Unsubscribe(topic string, subscription events.Subscriber) error

func UnwrapEvent

func UnwrapEvent[T any](event events.Event) T

Types

type LogEventBuffer added in v1.3.0

type LogEventBuffer []byte

Jump to

Keyboard shortcuts

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