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 ¶
- type FakeStream
- type Output
- func (o *Output) Close()
- func (o *Output) GetStream(prefix, stream string) *FakeStream
- func (o *Output) MaxSendBundles() int
- func (o *Output) MaxSize() int
- func (o *Output) SendBundle(b *logpb.ButlerLogBundle) error
- func (o *Output) Stats() output.Stats
- func (o *Output) URLConstructionEnv() bootstrap.Environment
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) 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 ¶
MaxSendBundles implements output.Output
func (*Output) SendBundle ¶
func (o *Output) SendBundle(b *logpb.ButlerLogBundle) error
SendBundle implements output.Output
func (*Output) URLConstructionEnv ¶
func (o *Output) URLConstructionEnv() bootstrap.Environment
URLConstructionEnv implements output.Output