Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

scope

v0.8.2
github.com/tetratelabs/telemetry/scope

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

16 matches

Top ↑

Package scope provides a scoped logger facade for telemetry.Logger implementations.

Constants

Key

const (
	// Key used to store the name of scope in the logger key/value pairs.
	Key = "scope"
)

Variables

PanicOnUninitialized

var (

	// PanicOnUninitialized can be used when testing for sequencing issues
	// between creating log lines and initializing the actual logger
	// implementation to use.
	PanicOnUninitialized bool
)

Functions

DefaultLevel

func DefaultLevel() telemetry.Level

DefaultLevel returns the logging level used for new scopes.

List

func List() map[string]Scope

List all registered Scopes

Names

func Names() []string

Names returns all registered scope names.

PrintRegistered

func PrintRegistered()

PrintRegistered outputs a list of registered scopes with their log level on stdout.

SetAllScopes

func SetAllScopes(lvl telemetry.Level)

SetAllScopes sets the logging level to all existing scopes and uses this level for new scopes.

SetDefaultLevel

func SetDefaultLevel(lvl telemetry.Level)

SetDefaultLevel sets the default level used for new scopes.

UseLogger

func UseLogger(logger telemetry.Logger)

UseLogger takes a logger and updates already registered scopes to use it. This function can only be used once. It can't override an already initialized logger. Therefore, set this as soon as possible.

Types

Scope

type Scope interface {
	telemetry.Logger

	// Name of the logging scope
	Name() string
	// Description of the logging scope
	Description() string
}

Scope configures a named logger that can be configured independently.

Find

func Find(name string) (Scope, bool)

Find a scoped logger by its name.

Register

func Register(name, description string) Scope

Register a new scoped Logger.

Dependency graph