logging

package
v0.5.1-rc6 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsHex

func AsHex(v interface{}) interface{}

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 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 testing.TB, format, level string, trace bool) log.Logger

func ParseLogLevel

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

func TestLogWriter

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

Types

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 Hex

type Hex []byte

func (Hex) MarshalJSON

func (h Hex) MarshalJSON() ([]byte, error)

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) With

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

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 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