logging
v0.0.0-20170305070534-03b6463409fe
github.com/cncd/logging
Documentation
pkg.go.dev ↗Variables
ErrNotFound
var ErrNotFound = errors.New("stream: not found")
ErrNotFound is returned when the log does not exist.
Types
Entry
type Entry struct {
// ID identifies this message.
ID string `json:"id,omitempty"`
// Data is the actual data in the entry.
Data []byte `json:"data"`
// Tags represents the key-value pairs the
// entry is tagged with.
Tags map[string]string `json:"tags,omitempty"`
}
Entry defines a log entry.
Handler
type Handler func(...*Entry)
Handler defines a callback function for handling log entries.
Log
type Log interface {
// Open opens the log.
Open(c context.Context, path string) error
// Write writes the entry to the log.
Write(c context.Context, path string, entry *Entry) error
// Tail tails the log.
Tail(c context.Context, path string, handler Handler) error
// Close closes the log.
Close(c context.Context, path string) error
// Snapshot snapshots the stream to Writer w.
Snapshot(c context.Context, path string, w io.Writer) error
}
Log defines a log multiplexer.
New
func New() Log
New returns a new logger.