log

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoType = iota
	ErrorType
	NodeType
	ServiceType
	StringType
	IntType
	UintType
	BytesType
	FloatType
	FunctionType
	SourceType
	StringArrayType
	TimeType
	AggregateType
)
View Source
const (
	SPACE  = " "
	EQUALS = "="
)
View Source
const DEFAULT_TIMESTAMP_COLUMN = "timestamp"
View Source
const TIMESTAMP_FORMAT = "2006-01-02T15:04:05.999999999Z"

Variables

This section is empty.

Functions

func NewHttpWriter

func NewHttpWriter(url string) io.Writer

func NewJsonFormatter

func NewJsonFormatter() *jsonFormatter

Types

type AggregateField

type AggregateField interface {
	NestedFields() []*Field
}

type BasicLogger

type BasicLogger interface {
	Log(level string, message string, params ...*Field)
	LogFailedExpectation(message string, expected *Field, actual *Field, params ...*Field)
	Info(message string, params ...*Field)
	Error(message string, params ...*Field)
	Metric(params ...*Field)
	WithTags(params ...*Field) BasicLogger
	Tags() []*Field
	WithOutput(writer ...Output) BasicLogger
	WithFilters(filter ...Filter) BasicLogger
}

func GetLogger

func GetLogger(params ...*Field) BasicLogger

type ErrorRecordingOutput

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

func NewErrorRecordingOutput

func NewErrorRecordingOutput(allowedErrors []string) *ErrorRecordingOutput

func (*ErrorRecordingOutput) Append

func (o *ErrorRecordingOutput) Append(level string, message string, params ...*Field)

func (*ErrorRecordingOutput) GetUnexpectedErrors

func (o *ErrorRecordingOutput) GetUnexpectedErrors() (errors []string)

func (*ErrorRecordingOutput) HasErrors

func (o *ErrorRecordingOutput) HasErrors() bool

type Field

type Field struct {
	Key  string
	Type FieldType

	StringVal   string
	StringArray []string
	Int         int64
	Uint        uint64
	Bytes       []byte
	Float       float64

	Error  error
	Nested AggregateField
}

func BlockHeight

func BlockHeight(value primitives.BlockHeight) *Field

func Bytes

func Bytes(key string, value []byte) *Field

func Error

func Error(value error) *Field

func Float32

func Float32(key string, value float32) *Field

func Float64

func Float64(key string, value float64) *Field

func Function

func Function(value string) *Field

func Int

func Int(key string, value int) *Field

func Int32

func Int32(key string, value int32) *Field

func Int64

func Int64(key string, value int64) *Field

func Node

func Node(value string) *Field

func Service

func Service(value string) *Field

func Source

func Source(value string) *Field

func String

func String(key string, value string) *Field

func Stringable

func Stringable(key string, value fmt.Stringer) *Field

func StringableSlice

func StringableSlice(key string, values interface{}) *Field

func Timestamp

func Timestamp(key string, value time.Time) *Field

func TimestampNano

func TimestampNano(key string, value primitives.TimestampNano) *Field

func Transaction

func Transaction(txHash primitives.Sha256) *Field

func Uint

func Uint(key string, value uint) *Field

func Uint32

func Uint32(key string, value uint32) *Field

func Uint64

func Uint64(key string, value uint64) *Field

func VirtualChainId

func VirtualChainId(value primitives.VirtualChainId) *Field

func (*Field) Equal

func (f *Field) Equal(other *Field) bool

func (*Field) IsNested

func (f *Field) IsNested() bool

func (*Field) String

func (f *Field) String() string

func (*Field) Value

func (f *Field) Value() interface{}

type FieldType

type FieldType uint8

type Filter

type Filter interface {
	Allows(level string, message string, fields []*Field) bool
}

func DiscardAll

func DiscardAll() Filter

func ExcludeEntryPoint

func ExcludeEntryPoint(name string) Filter

func ExcludeField

func ExcludeField(field *Field) Filter

func IgnoreErrorsMatching

func IgnoreErrorsMatching(pattern string) Filter

func IgnoreMessagesMatching

func IgnoreMessagesMatching(pattern string) Filter

func IncludeFieldWithKey

func IncludeFieldWithKey(key string) Filter

func MatchField

func MatchField(f *Field) Filter

func OnlyCheckpoints

func OnlyCheckpoints() Filter

func OnlyErrors

func OnlyErrors() Filter

func OnlyMetrics

func OnlyMetrics() Filter

func Or

func Or(filters ...Filter) Filter

type LogFormatter

type LogFormatter interface {
	FormatRow(timestamp time.Time, level string, message string, params ...*Field) (formattedRow string)
}

func NewHumanReadableFormatter

func NewHumanReadableFormatter() LogFormatter

type Output

type Output interface {
	Append(level string, message string, fields ...*Field)
}

func NewBulkOutput

func NewBulkOutput(writer io.Writer, formatter LogFormatter, bulkSize int) Output

func NewFormattingOutput

func NewFormattingOutput(writer io.Writer, formatter LogFormatter) Output

Jump to

Keyboard shortcuts

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