context

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// WaitGroup is used to wait for asynchronous workers to complete.
	WaitGroup *sync.WaitGroup
	// Ctx will be canceled when SIGINT or SIGTERM are notified.
	Ctx context.Context

	// Some parameters
	Logger zerolog.Logger
}

Context of execution. It consists of logger and cancelation context.

func New

func New() Context

New create new Context.

func (Context) WithContext

func (c Context) WithContext(ctx context.Context) Context

WithContext sets Context and returns self copy.

func (Context) WithFields

func (c Context) WithFields(f func(f Fields) Fields) Context

WithFields sets Logger fields and returns a copy of the context.

ctx := context.New().WithFields(func(f context.Fields) context.Fields){
    return f.Str("Version", "v1.2.3")
})

func (Context) WithLogger

func (c Context) WithLogger(l zerolog.Logger) Context

WithFields sets Logger and returns a copy of the context.

type Fields

type Fields = zerolog.Context

Fields is alias to zerolog.Context.

Jump to

Keyboard shortcuts

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