testlog

package
v0.52.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustLogFromYAML

func MustLogFromYAML(text string, fieldReaders ...log.FieldSetReader) *log.Log

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

func NewEmptyLogWithID

func NewEmptyLogWithID(id string) *log.Log

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(fieldSetReaders ...log.FieldSetReader) *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 maps in ancestor when it doens'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 maps in ancestor when it doens'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