level

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package level provides an interface and wrapper implementation for leveled logging.

Index

Constants

This section is empty.

Variables

View Source
var (
	DebugLevel = []interface{}{"level", "debug"}
	InfoLevel  = []interface{}{"level", "info"}
	ErrorLevel = []interface{}{"level", "error"}
)

Adjustable level key-value pairs

Functions

This section is empty.

Types

type Logger

type Logger interface {
	telemetry.Logger

	// SetLevel provides the ability to set the desired logging level.
	// This function can be used at runtime and must be safe for concurrent use.
	//
	// Note for Logger implementations, When creating a new Logger with the
	// With, Context, or Metric methods, the level should be set-able for all
	// from any of the Loggers sharing the same root Logger.
	SetLevel(lvl Value)

	// Level returns the currently configured logging level.
	Level() Value

	// New returns a new Logger based on the original implementation but with
	// the log level decoupled.
	New() telemetry.Logger
}

Logger is an interface for Loggers that support Log Levels.

func NoopLogger added in v0.6.0

func NoopLogger() Logger

NoopLogger returns a no-op Logger.

func Wrap

func Wrap(l telemetry.Logger) Logger

Wrap takes a telemetry.Logger implementation and wraps it with Log Level functionality.

type Value

type Value int32

Value is an enumeration of the available log levels.

const (
	None  Value = 0
	Error Value = 1
	Info  Value = 5
	Debug Value = 10
)

Available log levels.

Jump to

Keyboard shortcuts

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