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 ¶
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 (*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.
Click to show internal directories.
Click to hide internal directories.