livelog

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const GlobalStream = 0

Variables

This section is empty.

Functions

func GlobalStreamHandler

func GlobalStreamHandler(c *gin.Context)

func Init

func Init()

Types

type Line

type Line struct {
	Type      string      `json:"Type"`
	Message   interface{} `json:"Message"`
	Timestamp int64       `json:"Time"`
}

Line is a single line of the log.

func NewLine

func NewLine(messageType string, message interface{}) *Line

NewLine creates a line.

type Streamer

type Streamer struct {
	sync.Mutex
	// contains filtered or unexported fields
}
var Stream *Streamer

func (*Streamer) Create

func (s *Streamer) Create(id int64) error

Create adds a new log stream.

func (*Streamer) Delete

func (s *Streamer) Delete(id int64) error

Delete removes a log by id.

func (*Streamer) Info

func (s *Streamer) Info() map[int64]int

Info returns the count of subscribers in each stream.

func (*Streamer) Tail

func (s *Streamer) Tail(ctx context.Context, id int64) (<-chan *Line, <-chan error)

Tail returns the end signal.

func (*Streamer) Write

func (s *Streamer) Write(id int64, line *Line) error

Write adds a new line into stream.

Jump to

Keyboard shortcuts

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