provider

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeLogger ProviderType = iota
	TypeErrorReporter
	TypeMetrics

	LevelInfo Severity = iota
	LevelWarn
	LevelError
	LevelDebug
)

Variables

This section is empty.

Functions

func NewDefaultProvider

func NewDefaultProvider() interface{}

a NULL provider that does nothing but prevents NPEs in case someone forgets to actually initializa the 'real' provider

Types

type ErrorReportingProvider

type ErrorReportingProvider interface {
	ReportError(error)
}

type GenericProvider

type GenericProvider interface {
	Close() error
}

type InstanceProviderFunc

type InstanceProviderFunc func() interface{}

type LoggingProvider

type LoggingProvider interface {
	Log(string, ...string)
	LogWithLevel(Severity, string, ...string)
}

type MetricsProvider

type MetricsProvider interface {
	Meter(ctx context.Context, metric string, args ...string)
}

type ProviderConfig

type ProviderConfig struct {
	ID   string
	Type ProviderType
	Impl InstanceProviderFunc
}

func WithProvider

func WithProvider(ID string, providerType ProviderType, impl InstanceProviderFunc) ProviderConfig

WithProvider returns a populated ProviderConfig struct.

type ProviderType

type ProviderType int

func (ProviderType) String

func (l ProviderType) String() string

Returns the name of a provider type

type Severity

type Severity int

Jump to

Keyboard shortcuts

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