logt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOptions

func AddOptions(opts ...Option)

func SetOptions

func SetOptions(opts ...Option)

Types

type Assert

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

func (Assert) Attr

func (a Assert) Attr(name string, expected any, msgAndArgs ...any) bool

func (Assert) Count

func (a Assert) Count(count int, msgAndArgs ...any) bool

func (Assert) Empty

func (a Assert) Empty(msgAndArgs ...any) bool

func (Assert) Message

func (a Assert) Message(expected string, msgAndArgs ...any) bool

func (Assert) NotEmpty

func (a Assert) NotEmpty(msgAndArgs ...any) bool

type AssertGroup

type AssertGroup[K comparable] struct {
	// contains filtered or unexported fields
}

func (AssertGroup[K]) Count

func (a AssertGroup[K]) Count(expected map[K]int, msgAndArgs ...any) bool

type Group

type Group[K comparable] struct {
	T LogT `chaingen:"-"`
	// contains filtered or unexported fields
}

func (Group[K]) Aggregate

func (g Group[K]) Aggregate(fn genq.AggregationFunc[logq.Record]) map[K]logq.Record

func (Group[K]) AggregateFlat

func (g Group[K]) AggregateFlat(fn genq.AggregationFunc[logq.Record]) logq.Records

func (Group[K]) Assert

func (g Group[K]) Assert() AssertGroup[K]

func (Group[K]) Count

func (g Group[K]) Count() map[K]int

func (Group[K]) Require

func (g Group[K]) Require() RequireGroup[K]

type LogT

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

func New

func New(t *testing.T, opts ...Option) LogT

func Start

func Start(t *testing.T, opts ...Option) LogT

func (LogT) Collect

func (t LogT) Collect(filters ...logq.FilterFunc) Records

func (LogT) Finish

func (t LogT) Finish() Records

func (LogT) Scope

func (t LogT) Scope(fn func(lgt LogT)) Records

func (LogT) Start

func (t LogT) Start() LogT

func (LogT) T

func (t LogT) T() *testing.T

func (LogT) Wait

func (t LogT) Wait(opts ...logwait.Option) Records

func (LogT) WithCollectFilter

func (t LogT) WithCollectFilter(filters ...logq.FilterFunc) LogT

WithCollectFilter sets a collector filter which affects which records are visible to LogT

func (LogT) WithOptions

func (t LogT) WithOptions(opts ...Option) LogT

WithOptions sets new options to LogT

func (LogT) WithT

func (t LogT) WithT(tt *testing.T) LogT

func (LogT) WithWaitContext

func (t LogT) WithWaitContext(ctx context.Context) LogT

WithWaitContext sets a default context for LogT.Wait

func (LogT) WithWaitTimeout

func (t LogT) WithWaitTimeout(timeout time.Duration) LogT

WithWaitTimeout sets a default timeout for LogT.Wait

type Option

type Option func(o *options)

func WithCollectFilter

func WithCollectFilter(filters ...logq.FilterFunc) Option

WithCollectFilter sets a collector filter which affects which records are visible to LogT

func WithCollector

func WithCollector(collector logcollect.Collector) Option

WithCollector sets a collector for LogT. Collector is required for LogT to function.

func WithWaitContext

func WithWaitContext(ctx context.Context) Option

WithWaitContext sets a default context for LogT.Wait

func WithWaitTimeout

func WithWaitTimeout(timeout time.Duration) Option

WithWaitTimeout sets a default timeout for LogT.Wait

type Records

type Records struct {
	T LogT `chaingen:"-"`
	// contains filtered or unexported fields
}

func Scope

func Scope(t *testing.T, f func(lgt LogT), opts ...Option) Records

func (Records) And

func (f Records) And(operands ...genq.FilterFunc[logq.Record]) Records

func (Records) Assert

func (f Records) Assert() Assert

func (Records) Attr

func (f Records) Attr(key string, value any) Records

func (Records) Group

func (Records) Message

func (f Records) Message(msg string) Records

func (Records) Or

func (f Records) Or(operands ...genq.FilterFunc[logq.Record]) Records

func (Records) Records

func (f Records) Records() logq.Records

func (Records) Require

func (f Records) Require() Require

func (Records) Where

func (f Records) Where(operands ...genq.FilterFunc[logq.Record]) Records

type Require

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

func (Require) Attr

func (r Require) Attr(name string, expected any, msgAndArgs ...any)

func (Require) Count

func (r Require) Count(count int, msgAndArgs ...any)

func (Require) Empty

func (r Require) Empty(msgAndArgs ...any)

func (Require) Message

func (r Require) Message(expected string, msgAndArgs ...any)

func (Require) NotEmpty

func (r Require) NotEmpty(msgAndArgs ...any)

type RequireGroup

type RequireGroup[K comparable] struct {
	// contains filtered or unexported fields
}

func (RequireGroup[K]) Count

func (r RequireGroup[K]) Count(expected map[K]int, msgAndArgs ...any)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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