log

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultSize   = 256
	DefaultFormat = TextFormat
)

Functions

func JsonFormat

func JsonFormat(r Record) string

func TextFormat

func TextFormat(r Record) string

Types

type FormatFunc

type FormatFunc func(Record) string

type Log

type Log interface {
	Read(...ReadOption) ([]Record, error)
	Write(Record) error
	Stream() (Steam, error)
}

type Option

type Option func(*Options)

func Format

func Format(format FormatFunc) Option

func Name

func Name(name string) Option

func Size

func Size(size int) Option

type Options

type Options struct {
	Name   string
	Size   int
	Format FormatFunc
}

func DefaultOptions

func DefaultOptions() Options

type ReadOption

type ReadOption func(*ReadOptions)

func Count

func Count(count int) ReadOption

func Since

func Since(since time.Time) ReadOption

func Stream

func Stream(stream bool) ReadOption

type ReadOptions

type ReadOptions struct {
	Since  time.Time
	Count  int
	Stream bool
}

type Record

type Record struct {
	Timestamp time.Time         `json:"timestamp"`
	Metadata  map[string]string `json:"metadata"`
	Message   interface{}       `json:"message"`
}

type Steam

type Steam interface {
	Chan() <-chan Record
	Stop() error
}

Jump to

Keyboard shortcuts

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