log

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 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

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

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

func (*Log) Segments

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

type OpenReaderOption

type OpenReaderOption func(*ReaderSettings) error

func StartingFrom

func StartingFrom(t time.Time) OpenReaderOption

type OpenWriterOption

type OpenWriterOption func(*WriterSettings) error

func MaxSegmentDuration

func MaxSegmentDuration(duration time.Duration) OpenWriterOption

func MaxSegmentSizeMB

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

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

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