log

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoggerWavelet   = "wavelet"
	LoggerWebsocket = "ws"

	KeyModule = "mod"
	KeyEvent  = "event"

	ModuleNode      = "node"
	ModuleNetwork   = "network"
	ModuleAccounts  = "accounts"
	ModuleConsensus = "consensus"
	ModuleContract  = "contract"
	ModuleSync      = "sync"
	ModuleStake     = "stake"
	ModuleTX        = "tx"
	ModuleMetrics   = "metrics"
)

Variables

This section is empty.

Functions

func Accounts

func Accounts(event string) zerolog.Logger

func Consensus

func Consensus(event string) zerolog.Logger

func Contracts

func Contracts(event string) zerolog.Logger

func FilterFor

func FilterFor(modules ...string) func(w *ConsoleWriter)

func Metrics

func Metrics() zerolog.Logger

func Network

func Network(event string) zerolog.Logger

func Node

func Node() zerolog.Logger

func SetLevel added in v0.2.0

func SetLevel(ls string)

func SetWriter

func SetWriter(key string, writer io.Writer)

func Stake

func Stake(event string) zerolog.Logger

func Sync

func Sync(event string) zerolog.Logger

func TX

func TX(event string) zerolog.Logger

Types

type ConsoleWriter

type ConsoleWriter struct {
	// Out is the output destination.
	Out io.Writer

	// NoColor disables the colorized output.
	NoColor bool

	// TimeFormat specifies the format for timestamp in output.
	TimeFormat string

	// PartsOrder defines the order of parts in output.
	PartsOrder []string

	FormatTimestamp     Formatter
	FormatLevel         Formatter
	FormatCaller        Formatter
	FormatMessage       Formatter
	FormatFieldName     Formatter
	FormatFieldValue    Formatter
	FormatErrFieldName  Formatter
	FormatErrFieldValue Formatter

	FilteredModules map[string]struct{}
}

ConsoleWriter parses the JSON input and writes it in an (optionally) colorized, human-friendly format to Out.

func NewConsoleWriter

func NewConsoleWriter(writer io.Writer, options ...func(w *ConsoleWriter)) ConsoleWriter

NewConsoleWriter creates and initializes a new ConsoleWriter.

func (ConsoleWriter) Write

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

Write transforms the JSON input with formatters and appends to w.Out.

type Formatter

type Formatter func(interface{}) string

Formatter transforms the input into a formatted string.

Jump to

Keyboard shortcuts

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