teelogger

package
v0.0.0-...-af6bcab Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Use

func Use(ctx context.Context, factories ...logging.Factory) context.Context

Use adds a tee logger to the context, using the logger factory in the context, as well as the other loggers produced by given factories.

We use factories (instead of logging.Logger instances), since we must be able to produce logging.Logger instances bound to contexts to be able to use logging levels are fields (they are part of the context state).

func UseFiltered

func UseFiltered(ctx context.Context, filtereds ...Filtered) context.Context

UseFiltered adds a tee logger to the context, using the logger factory in the context, as well as the other provided by given filtereds. Filtered loggers ignore the current logging level in the context.

We use factories (instead of logging.Logger instances), since we must be able to produce logging.Logger instances bound to contexts to be able to use logging levels are fields (they are part of the context state). The logger instance bound to context is used with level provided by context.

Types

type Filtered

type Filtered struct {
	Factory logging.Factory
	Level   logging.Level
}

Filtered is a static representation of a single entry to filter messages to loggers by provided level.

Jump to

Keyboard shortcuts

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