Version: v2.1.1+incompatible Latest Latest

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

Go to latest
Published: May 22, 2017 License: BSD-3-Clause Imports: 7 Imported by: 0



Package streamlog provides a non-blocking message broadcaster.



This section is empty.


This section is empty.


This section is empty.


type StreamLogger

type StreamLogger struct {
	// contains filtered or unexported fields

StreamLogger is a non-blocking broadcaster of messages. Subscribers can use channels or HTTP.

func New

func New(name string, size int) *StreamLogger

New returns a new StreamLogger that can stream events to subscribers. The size parameter defines the channel size for the subscribers.

func (*StreamLogger) Name

func (logger *StreamLogger) Name() string

Name returns the name of StreamLogger.

func (*StreamLogger) Send

func (logger *StreamLogger) Send(message interface{})

Send sends message to all the writers subscribed to logger. Calling Send does not block.

func (*StreamLogger) ServeLogs

func (logger *StreamLogger) ServeLogs(url string, messageFmt func(url.Values, interface{}) string)

ServeLogs registers the URL on which messages will be broadcast. It is safe to register multiple URLs for the same StreamLogger.

func (*StreamLogger) Subscribe

func (logger *StreamLogger) Subscribe(name string) chan interface{}

Subscribe returns a channel which can be used to listen for messages.

func (*StreamLogger) Unsubscribe

func (logger *StreamLogger) Unsubscribe(ch chan interface{})

Unsubscribe removes the channel from the subscription.

Source Files

Jump to

Keyboard shortcuts

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