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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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