log

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEOL              = errors.New("eol (end of log):  reading log finished")
	ErrLocked           = errors.New("log is already locked for writing")
	ErrInvalidParameter = errors.New("invalid parameter")
)

Functions

This section is empty.

Types

type Log

type Log struct {
	// contains filtered or unexported fields
}

func New

func New(dir string) *Log

func (*Log) LastEntry added in v0.6.0

func (l *Log) LastEntry() (time.Time, []byte, error)

func (*Log) OpenReader

func (l *Log) OpenReader(options ...OpenReaderOption) (Reader, error)

func (*Log) OpenWriter

func (l *Log) OpenWriter(options ...OpenWriterOption) (*Writer, error)

func (*Log) RemoveSegmentStartingAt added in v0.2.0

func (l *Log) RemoveSegmentStartingAt(t time.Time) error

func (*Log) Segments added in v0.2.0

func (l *Log) Segments() ([]Segment, error)

type OpenReaderOption

type OpenReaderOption func(*ReaderSettings) error

func StartingFrom added in v0.5.0

func StartingFrom(t time.Time) OpenReaderOption

type OpenWriterOption

type OpenWriterOption func(*WriterSettings) error

func MaxSegmentDuration added in v0.4.0

func MaxSegmentDuration(duration time.Duration) OpenWriterOption

func MaxSegmentSizeMB added in v0.2.0

func MaxSegmentSizeMB(megabytes int) OpenWriterOption

func NowFunc

func NowFunc(f func() time.Time) OpenWriterOption

type Reader

type Reader interface {
	Read() (time.Time, []byte, error)
	Close() error
}

type ReaderSettings

type ReaderSettings struct {
	// contains filtered or unexported fields
}

type Segment added in v0.2.0

type Segment struct {
	StartingAt time.Time
}

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Write

func (w *Writer) Write(entry []byte) (time.Time, error)

func (*Writer) WriteWithTime added in v0.5.0

func (w *Writer) WriteWithTime(t time.Time, entry []byte) error

type WriterSettings

type WriterSettings struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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