micro/debug/log/log.go

37 lines
610 B
Go
Raw Normal View History

2019-05-31 03:22:19 +03:00
// Package log provides a logging interface
package log
import (
"time"
)
// Log provides access to logs
type Log interface {
Read(...ReadOption) ([]*Entry, error)
Write([]*Entry, ...WriteOption) error
String() string
}
// A single log entry
type Entry struct {
Id string
Time time.Time
Message []byte
Metadata map[string]string
}
type ReadOption func(o *ReadOptions)
type WriteOption func(o *WriteOptions)
type ReadOptions struct {
// read the given id
Id string
// Number of entries to read
Entries int
// Filter function
Filter func(*Entry) bool
}
type WriteOptions struct{}