journal

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Journal

type Journal interface {
	// Topic returns a Writer that records events for a topic.
	Topic(topic string) Writer
}

Journal defines an interface for creating Journals with a topic.

func NewInMemoryJournal

func NewInMemoryJournal(t *testing.T, clk clock.Clock) Journal

NewInMemoryJournal returns a journal backed by an in-memory map.

func NewNoopJournal

func NewNoopJournal() Journal

NewNoopJournal returns a NoopJournal.

func NewZapJournal

func NewZapJournal(filepath string) (Journal, error)

NewZapJournal returns a Journal backed by a zap logger. ZapJournal writes entries as ndjson to file at `filepath`.

type MemoryJournal

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

MemoryJournal represents a journal held in memory.

func (*MemoryJournal) Topic

func (mj *MemoryJournal) Topic(topic string) Writer

Topic returns a Writer with the provided `topic`.

type MemoryWriter

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

MemoryWriter writes journal entires in memory.

func (*MemoryWriter) Write

func (mw *MemoryWriter) Write(event string, kvs ...interface{})

Write records an operation and its metadata to a Journal accepting variadic key-value pairs.

type NoopJournal

type NoopJournal struct{}

NoopJournal implements the Journal interface and Noops for all operations.

func (*NoopJournal) Topic

func (nj *NoopJournal) Topic(topic string) Writer

Topic returns a NoopWriter.

type NoopWriter

type NoopWriter struct{}

NoopWriter implements the Writer interface and Noops for all operations.

func (*NoopWriter) Write

func (nw *NoopWriter) Write(event string, kvs ...interface{})

Write Noops for all operations.

type Writer

type Writer interface {
	// Write records an operation and its metadata to a Journal accepting variadic key-value
	// pairs.
	Write(event string, kvs ...interface{})
}

Writer defines an interface for recording events and their metadata

type ZapJournal

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

ZapJournal implemented the Journal interface.

func (*ZapJournal) Topic

func (zj *ZapJournal) Topic(topic string) Writer

Topic returns a Writer that records events for a topic.

type ZapWriter

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

ZapWriter implements the Journal Write interface and is backed by a zap logger.

func (*ZapWriter) Write

func (zw *ZapWriter) Write(event string, kvs ...interface{})

Write records an operation and its metadata to a Journal accepting variadic key-value pairs.

Jump to

Keyboard shortcuts

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