context

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	*logger.Logger
	context.Context
	types.GarbageCollector
	Config    *types.BhojpurConfig
	NoSpinner bool
	// contains filtered or unexported fields
}

func NewContext

func NewContext(opts ...ContextOption) *Context

NewContext returns a new context. It accepts a Garbage collector, a config and a logger as an option

func (*Context) Copy

func (c *Context) Copy() types.Context

Copy returns a context copy with a reset logging context

func (*Context) GetAnnotation

func (c *Context) GetAnnotation(s string) interface{}

GetAnnotation gets generic annotations to hold in a context

func (*Context) GetConfig

func (c *Context) GetConfig() types.BhojpurConfig

func (*Context) SetAnnotation

func (c *Context) SetAnnotation(s string, i interface{})

SetAnnotation sets generic annotations to hold in a context

func (*Context) Warn

func (c *Context) Warn(mess ...interface{})

func (*Context) Warnf

func (c *Context) Warnf(t string, mess ...interface{})

func (*Context) Warning

func (c *Context) Warning(mess ...interface{})

func (*Context) Warningf

func (c *Context) Warningf(t string, mess ...interface{})

func (*Context) WithLoggingContext

func (c *Context) WithLoggingContext(name string) types.Context

WithLoggingContext returns a copy of the context with a contextualized logger

type ContextOption

type ContextOption func(c *Context) error

func WithConfig

func WithConfig(cc *types.BhojpurConfig) ContextOption

WithConfig sets the Bhojpur ISO config

func WithGarbageCollector

func WithGarbageCollector(l types.GarbageCollector) ContextOption

WithGarbageCollector sets the Garbage collector for the given context

func WithLogger

func WithLogger(l *logger.Logger) ContextOption

WithLogger sets the logger

Jump to

Keyboard shortcuts

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