logging

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyHook

func BodyHook(hook func(e *zerolog.Event, level zerolog.Level, body map[string]interface{})) zerolog.HookFunc

BodyHook is a HORRIBLE HACK, really the hackiest of hacks. It filters zerolog messages based on the log body. DO NOT USE THIS except for tests.

func ExcludeMessages

func ExcludeMessages(messages ...string) zerolog.HookFunc

func GetCurrentDateTime added in v1.0.0

func GetCurrentDateTime() (ymd string, hm string)

func NewConsoleWriter

func NewConsoleWriter(format string) (io.Writer, error)

NewConsoleWriter parses the log format and creates an appropriate writer. It is based on part of Tendermint's NewTendermintLogger.

func NewConsoleWriterWith

func NewConsoleWriterWith(w io.Writer, format string) (io.Writer, error)

func NewTendermintLogger

func NewTendermintLogger(zl zerolog.Logger, level string, trace bool) (log.Logger, error)

NewTendermintLogger is the default logger implementation for our Tendermint nodes. It is based on part of Tendermint's NewTendermintLogger.

func NewTestLogger

func NewTestLogger(t TB, format, level string, trace bool) log.Logger

func ParseLogLevel

func ParseLogLevel(s string, w io.Writer) (string, io.Writer, error)

func Recover added in v1.0.0

func Recover(logger log.Logger, message string, values ...interface{})

func TestLogWriter

func TestLogWriter(t TB) func(string) (io.Writer, error)

Types

type DataSet added in v1.0.0

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

func (*DataSet) Lock added in v1.0.0

func (d *DataSet) Lock() *DataSet

func (*DataSet) Save added in v1.0.0

func (d *DataSet) Save(label string, value any, precisionOrWidth int, first bool) *DataSet

func (*DataSet) SetHeader added in v1.0.0

func (d *DataSet) SetHeader(header string)

func (*DataSet) Unlock added in v1.0.0

func (d *DataSet) Unlock()

type DataSetLog added in v1.0.0

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

func (*DataSetLog) DumpDataSetToDiskFile added in v1.0.0

func (d *DataSetLog) DumpDataSetToDiskFile() ([]string, error)

func (*DataSetLog) GetDataSet added in v1.0.0

func (d *DataSetLog) GetDataSet(id string) *DataSet

func (*DataSetLog) Initialize added in v1.0.0

func (d *DataSetLog) Initialize(key string, opts Options)

func (*DataSetLog) SetFileTag added in v1.0.0

func (d *DataSetLog) SetFileTag(parts ...string)

func (*DataSetLog) SetHeader added in v1.0.0

func (d *DataSetLog) SetHeader(header string)

func (*DataSetLog) SetPath added in v1.0.0

func (d *DataSetLog) SetPath(path string)

func (*DataSetLog) SetProcessName added in v1.0.0

func (d *DataSetLog) SetProcessName(process string)

type FilterWriter

type FilterWriter struct {
	Out       io.Writer
	Predicate func(zerolog.Level, map[string]interface{}) bool
}

func (FilterWriter) Write

func (w FilterWriter) Write(p []byte) (n int, err error)

func (FilterWriter) WriteLevel

func (w FilterWriter) WriteLevel(level zerolog.Level, p []byte) (n int, err error)

type LogAsHex added in v0.5.1

type LogAsHex interface {
	Slice(i, j int) LogAsHex
}

func AsHex

func AsHex(v interface{}) LogAsHex

type LogAsHexSlice added in v0.5.1

type LogAsHexSlice []LogAsHex

func (LogAsHexSlice) Slice added in v0.5.1

func (v LogAsHexSlice) Slice(i, j int) LogAsHex

type LogAsHexValue added in v0.5.1

type LogAsHexValue []byte

func (LogAsHexValue) MarshalJSON added in v0.5.1

func (v LogAsHexValue) MarshalJSON() ([]byte, error)

func (LogAsHexValue) Slice added in v0.5.1

func (v LogAsHexValue) Slice(i, j int) LogAsHex

type LogWithFormat added in v0.6.0

type LogWithFormat struct {
	Format string
	Values []interface{}
}

func WithFormat added in v0.6.0

func WithFormat(format string, values ...interface{}) LogWithFormat

func (LogWithFormat) MarshalJSON added in v0.6.0

func (v LogWithFormat) MarshalJSON() ([]byte, error)

type NullLogger added in v0.5.1

type NullLogger struct{}

func (NullLogger) Debug added in v0.5.1

func (NullLogger) Debug(msg string, keyVals ...interface{})

func (NullLogger) Error added in v0.5.1

func (NullLogger) Error(msg string, keyVals ...interface{})

func (NullLogger) Info added in v0.5.1

func (NullLogger) Info(msg string, keyVals ...interface{})

func (NullLogger) With added in v0.5.1

func (l NullLogger) With(keyVals ...interface{}) log.Logger

type OptionalLogger

type OptionalLogger struct {
	L log.Logger
}

func (OptionalLogger) Debug

func (l OptionalLogger) Debug(msg string, keyVals ...interface{})

func (OptionalLogger) Error

func (l OptionalLogger) Error(msg string, keyVals ...interface{})

func (OptionalLogger) Info

func (l OptionalLogger) Info(msg string, keyVals ...interface{})

func (*OptionalLogger) Set added in v1.0.0

func (l *OptionalLogger) Set(m log.Logger, keyVals ...interface{})

func (OptionalLogger) With

func (l OptionalLogger) With(keyVals ...interface{}) log.Logger

type Options added in v1.0.0

type Options struct {
	Header      string
	MaxDataSize uint
}

func DefaultOptions added in v1.0.0

func DefaultOptions() Options

type ServiceLogger

type ServiceLogger struct {
	Service service.Logger
	// contains filtered or unexported fields
}

func NewServiceLogger

func NewServiceLogger(svc service.Service, format string) (*ServiceLogger, error)

func (*ServiceLogger) Write

func (l *ServiceLogger) Write(b []byte) (int, error)

func (*ServiceLogger) WriteLevel

func (l *ServiceLogger) WriteLevel(level zerolog.Level, b []byte) (int, error)

type TB added in v0.6.0

type TB interface {
	Name() string
	Log(...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	FailNow()
	Helper()
}

type TendermintZeroLogger

type TendermintZeroLogger struct {
	Zerolog zerolog.Logger
	Trace   bool
}

TendermintZeroLogger is a Tendermint logger implementation that passes messages to a Zerolog logger. It is basically a complete clone of Tendermint's default logger.

func (*TendermintZeroLogger) Debug

func (l *TendermintZeroLogger) Debug(msg string, keyVals ...interface{})

func (*TendermintZeroLogger) Error

func (l *TendermintZeroLogger) Error(msg string, keyVals ...interface{})

func (*TendermintZeroLogger) Info

func (l *TendermintZeroLogger) Info(msg string, keyVals ...interface{})

func (*TendermintZeroLogger) With

func (l *TendermintZeroLogger) With(keyVals ...interface{}) log.Logger

Jump to

Keyboard shortcuts

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