Documentation ¶
Index ¶
- Constants
- func FileLogSubscriber(file *os.File) (events.Subscriber, error)
- func IOLogSubscriber(w io.Writer) (events.Subscriber, error)
- func InitLogger(logLevel string, encoding logs.Encoding, options ...zap.Option) (*zap.Logger, error)
- func New()
- func Publish(routingKey string, event any) error
- func SplitStdoutStderrLogSubscriber() ([]events.Subscriber, error)
- func StderrLogSubscriber() (events.Subscriber, error)
- func StdoutLogSubscriber() (events.Subscriber, error)
- func Stop()
- func Subscribe(topic string) (events.Subscriber, error)
- func Unsubscribe(topic string, subscription events.Subscriber) error
- func UnwrapEvent[T any](event events.Event) T
- type LogEventBuffer
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 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 Unsubscribe ¶
func Unsubscribe(topic string, subscription events.Subscriber) error
func UnwrapEvent ¶
Types ¶
type LogEventBuffer ¶ added in v1.3.0
type LogEventBuffer []byte
Click to show internal directories.
Click to hide internal directories.