Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustLogFromYAML ¶
MustLogFromYAML returns a log.Log instance from given YAML string. This method is for testing only.
func NewEmptyLogWithID ¶
NewEmptyLogWithID creates a new empty Log with the given ID.
func NewMockLog ¶ added in v0.58.2
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 (*TestLog) MustBuildYamlString ¶
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.