logging

package module
v0.0.0-...-03b6463 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2017 License: BSD-3-Clause Imports: 4 Imported by: 50

README

Go package provides a common interface for storing and streaming logs.

Documentation:

    http://godoc.org/github.com/cncd/logging
    http://godoc.org/github.com/cncd/logging/gcp

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("stream: not found")

ErrNotFound is returned when the log does not exist.

Functions

This section is empty.

Types

type 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.

type Handler

type Handler func(...*Entry)

Handler defines a callback function for handling log entries.

type 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.

func New

func New() Log

New returns a new logger.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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