log

package
v0.35.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 8 Imported by: 1,832 modules, 11,866 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// LogFormatPlain defines a logging format used for human-readable text-based
	// logging that is not structured. Typically, this format is used for development
	// and testing purposes.
	LogFormatPlain string = "plain"

	// LogFormatText defines a logging format used for human-readable text-based
	// logging that is not structured. Typically, this format is used for development
	// and testing purposes.
	LogFormatText string = "text"

	// LogFormatJSON defines a logging format for structured JSON-based logging
	// that is typically used in production environments, which can be sent to
	// logging facilities that support complex log parsing and querying.
	LogFormatJSON string = "json"

	// Supported loging levels
	LogLevelDebug = "debug"
	LogLevelInfo  = "info"
	LogLevelWarn  = "warn"
	LogLevelError = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Debug(msg string, keyVals ...interface{})
	Info(msg string, keyVals ...interface{})
	Error(msg string, keyVals ...interface{})

	With(keyVals ...interface{}) Logger
}

Logger defines a generic logging interface compatible with Tendermint.

func MustNewDefaultLogger added in v0.35.0

func MustNewDefaultLogger(format, level string, trace bool) Logger

MustNewDefaultLogger delegates a call NewDefaultLogger where it panics on error.

func NewDefaultLogger added in v0.35.0

func NewDefaultLogger(format, level string, trace bool) (Logger, error)

NewDefaultLogger returns a default logger that can be used within Tendermint and that fulfills the Logger interface. The underlying logging provider is a zerolog logger that supports typical log levels along with JSON and plain/text log formats.

Since zerolog supports typed structured logging and it is difficult to reflect that in a generic interface, all logging methods accept a series of key/value pair tuples, where the key must be a string.

func NewNopLogger

func NewNopLogger() Logger

func TestingLogger

func TestingLogger() Logger

TestingLogger returns a Logger which writes to STDOUT if test(s) are being run with the verbose (-v) flag, NopLogger otherwise.

NOTE: - A call to NewTestingLogger() must be made inside a test (not in the init func) because verbose flag only set at the time of testing.

func TestingLoggerWithOutput

func TestingLoggerWithOutput(w io.Writer) Logger

Jump to

Keyboard shortcuts

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