testlog

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustLogFromYAML

func MustLogFromYAML(text string) *log.Log

MustLogFromYAML returns a log.Log instance from given YAML string. This method is for testing only.

func NewEmptyLogWithID

func NewEmptyLogWithID(logID uint32) *log.Log

NewEmptyLogWithID creates a new empty Log with the given ID.

func NewMockLog added in v0.58.2

func NewMockLog(mockValues ...any) *log.Log

NewMockLog returns a *log.Log populated with the provided typed mock data structures.

Types

type TestLog

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

TestLog is a type to generate mock log data effectively for test.

func New

func New(opts ...TestLogOpt) *TestLog

func (*TestLog) BuildReader

func (b *TestLog) BuildReader() (*structured.NodeReader, error)

func (*TestLog) MustBuildLogEntity

func (b *TestLog) MustBuildLogEntity() *log.Log

func (*TestLog) MustBuildYamlString

func (b *TestLog) MustBuildYamlString() string

func (*TestLog) With

func (b *TestLog) With(additionalOpts ...TestLogOpt) *TestLog

With instantiate a new TestLog with the given additional options and the current options.

type TestLogOpt

type TestLogOpt = func(original structured.Node) (structured.Node, error)

func IntField

func IntField(fieldPath string, value int) TestLogOpt

IntField returns a TestLogOpt modifying the field at the specified fieldPath to the value. It creates ancestor maps when they don't exist.

func StringField

func StringField(fieldPath string, value string) TestLogOpt

StringField returns a TestLogOpt modifying the field at the specified fieldPath to the value. It creates ancestor maps when they don't exist.

func YAML

func YAML(yamlStr string) TestLogOpt

YAML function returns a TestLogOpt generating the structure node with given YAML string.

Jump to

Keyboard shortcuts

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