logfmt

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldMapMarshaller

type FieldMapMarshaller map[string]interface{}

func (FieldMapMarshaller) MarshalLogFields

func (v FieldMapMarshaller) MarshalLogFields(w LogObjectWriter)

type FieldReporterFunc

type FieldReporterFunc func(collector LogObjectMetricCollector, fieldName string, v interface{})

type FormatFunc

type FormatFunc func(...interface{}) string

type FormatfFunc

type FormatfFunc func(string, ...interface{}) string

type LogField

type LogField struct {
	Name  string
	Value interface{}
}

func (LogField) MarshalLogFields

func (v LogField) MarshalLogFields(w LogObjectWriter)

func (LogField) MarshalLogObject

func (v LogField) MarshalLogObject(w LogObjectWriter, _ LogObjectMetricCollector) (string, bool)

type LogFieldFormat

type LogFieldFormat struct {
	Fmt    string
	Kind   reflect.Kind
	HasFmt bool
}

func (LogFieldFormat) IsInt

func (f LogFieldFormat) IsInt() bool

func (LogFieldFormat) IsUint

func (f LogFieldFormat) IsUint() bool

type LogFieldMarshaller

type LogFieldMarshaller interface {
	MarshalLogFields(LogObjectWriter)
}

type LogFields

type LogFields struct {
	Msg    string
	Fields map[string]interface{}
}

func (LogFields) MarshalLogFields

func (v LogFields) MarshalLogFields(w LogObjectWriter)

func (LogFields) MarshalLogObject

func (v LogFields) MarshalLogObject(w LogObjectWriter, _ LogObjectMetricCollector) (string, bool)

type LogObject

type LogObject interface {
	// should return nil to use default (external) marshaller
	GetLogObjectMarshaller() LogObjectMarshaller
}

Presence of this interface indicates that this object can be used as a log event

type LogObjectFields

type LogObjectFields struct {
	Object LogObjectMarshaller
}

func (LogObjectFields) MarshalLogFields

func (v LogObjectFields) MarshalLogFields(w LogObjectWriter)

func (LogObjectFields) MarshalLogObject

type LogObjectMarshaller

type LogObjectMarshaller interface {
	MarshalLogObject(LogObjectWriter, LogObjectMetricCollector) (msg string, defMsg bool)
}

type LogObjectMetricCollector

type LogObjectMetricCollector interface {
	LogObjectMetricCollector()
}

type LogObjectWriter

type LogObjectWriter interface {
	AddIntField(key string, v int64, fmt LogFieldFormat)
	AddUintField(key string, v uint64, fmt LogFieldFormat)
	AddBoolField(key string, v bool, fmt LogFieldFormat)
	AddFloatField(key string, v float64, fmt LogFieldFormat)
	AddComplexField(key string, v complex128, fmt LogFieldFormat)
	AddStrField(key string, v string, fmt LogFieldFormat)
	AddIntfField(key string, v interface{}, fmt LogFieldFormat)
	AddTimeField(key string, v time.Time, fmt LogFieldFormat)
	AddRawJSONField(key string, v interface{}, fmt LogFieldFormat)
	AddErrorField(msg string, stack throw.StackTrace, severity throw.Severity, hasPanic bool)
}

type LogStringer

type LogStringer interface {
	LogString() string
}

type MarshallerFactory

type MarshallerFactory interface {
	CreateErrorMarshaller(error) LogObjectMarshaller
	CreateLogObjectMarshaller(reflect.Value) LogObjectMarshaller
}

func GetMarshallerFactory

func GetMarshallerFactory() MarshallerFactory

type MsgFormatConfig

type MsgFormatConfig struct {
	Sformat  FormatFunc
	Sformatf FormatfFunc
	MFactory MarshallerFactory

	TimeFmt string
}

func GetDefaultLogMsgFormatter

func GetDefaultLogMsgFormatter() MsgFormatConfig

func (MsgFormatConfig) FmtLogObject

func (v MsgFormatConfig) FmtLogObject(a ...interface{}) string

func (MsgFormatConfig) FmtLogStruct

func (v MsgFormatConfig) FmtLogStruct(a interface{}) (LogObjectMarshaller, string)

func (MsgFormatConfig) FmtLogStructOrObject

func (v MsgFormatConfig) FmtLogStructOrObject(a interface{}) (LogObjectMarshaller, string)

func (MsgFormatConfig) PrepareMutedLogObject

func (v MsgFormatConfig) PrepareMutedLogObject(a ...interface{}) LogObjectMarshaller

type MsgTemplate

type MsgTemplate struct{}

func (*MsgTemplate) GetLogObjectMarshaller

func (*MsgTemplate) GetLogObjectMarshaller() LogObjectMarshaller

type MutedLogObjectMarshaller

type MutedLogObjectMarshaller interface {
	MarshalMutedLogObject(LogObjectMetricCollector)
}

Jump to

Keyboard shortcuts

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