Documentation

Overview

Package memory implements an in-memory sink for the logdog Butler.

This is meant for absorbing log data during testing of applications which expect a live Butler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeStream

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

FakeStream holds the data recorded by a single stream in Output.

func (*FakeStream) AllData

func (fs *FakeStream) AllData() []string

AllData returns all datagrams for this stream.

If this is a BINARY or TEXT stream, this will always return exactly one string.

If fs == nil, returns nil.

func (*FakeStream) LastData

func (fs *FakeStream) LastData() string

LastData returns the last datagram for this stream.

If this is a BINARY or TEXT stream, this returns the stream data.

If fs == nil, returns "".

func (*FakeStream) StreamType

func (fs *FakeStream) StreamType() logpb.StreamType

StreamType returns the categorization of this stream (TEXT, BINARY, DATAGRAM).

func (*FakeStream) Tags

func (fs *FakeStream) Tags() map[string]string

Tags returns any tags set for this stream.

type Output

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

Output implements the butler output.Output interface, but just accumulates the data in memory.

For simplicity, this only retains a subset of the data transmitted by SendBundle (e.g. no timestamps, indexes, etc.).

This assumes that SendBundle is called in order.

func (*Output) Close

func (o *Output) Close()

Close implements output.Output

func (*Output) GetStream

func (o *Output) GetStream(prefix, stream string) *FakeStream

GetStream returns the *FakeStream corresponding to the given prefix and stream name.

If no such stream was opened, returns nil.

func (*Output) MaxSendBundles

func (o *Output) MaxSendBundles() int

MaxSendBundles implements output.Output

func (*Output) MaxSize

func (o *Output) MaxSize() int

MaxSize returns a large number instead of 0 because butler has bugs.

func (*Output) SendBundle

func (o *Output) SendBundle(b *logpb.ButlerLogBundle) error

SendBundle implements output.Output

func (*Output) Stats

func (o *Output) Stats() output.Stats

Stats implements output.Output

func (*Output) URLConstructionEnv

func (o *Output) URLConstructionEnv() bootstrap.Environment

URLConstructionEnv implements output.Output

Source Files