handlers

package
v0.0.0-...-7893cc3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	// Enabled returns a boolean on whether the Handler is accepting
	// records with log level `level`
	Enabled(level level.Level) bool
	// Handle will process the input Record, returning an error if raised
	Handle(records.Record) error
	// With will spawn a copy of this Handler with the input attributes
	// `attrs`
	With(attrs ...attr.Attr) Handler

	// WithSource will spawn a new copy of this Handler with the setting
	// to add a source file+line reference to `addSource` boolean
	WithSource(addSource bool) Handler

	// WithLevel will spawn a copy of this Handler with the input level `level`
	// as a verbosity filter
	WithLevel(level level.Level) Handler

	// WithReplaceFn will spawn a copy of this Handler with the input attribute
	// replace function `fn`
	WithReplaceFn(fn func(a attr.Attr) attr.Attr) Handler
}

Handler describes a logging backend, capable of writing a Record to an io.Writer (with its Handle() method).

Beyond this feature, it also exposes methods of copying it with different configuration options.

func Multi

func Multi(h ...Handler) Handler

Multi will take any number of Handlers and return a multiHandler that batches the method calls similarly across all Handlers

The resulting multiHandler is immutable

func Unimpl

func Unimpl() Handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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