Documentation
¶
Index ¶
- type Context
- func Background() *Context
- func ErrGroup(ctx *Context) (*errgroup.Group, *Context)
- func FromGrpcCtx(ctx context.Context) *Context
- func New(ctx context.Context, log *logging.Logger) *Context
- func TODO() *Context
- func WithCancel(parent *Context) (*Context, context.CancelFunc)
- func WithDeadline(parent *Context, d time.Time) (*Context, context.CancelFunc)
- func WithLogField(parent *Context, key string, val any) *Context
- func WithLogFields(parent *Context, fields map[string]any) *Context
- func WithTimeout(parent *Context, timeout time.Duration) (*Context, context.CancelFunc)
- func WithValue(parent *Context, key, val any) *Context
- func (ctx *Context) Debug(msg string)
- func (ctx *Context) Debugf(format string, args ...interface{})
- func (ctx *Context) Error(msg string)
- func (ctx *Context) Errorf(format string, args ...interface{})
- func (ctx *Context) Fatal(msg string)
- func (ctx *Context) Fatalf(format string, args ...interface{})
- func (ctx *Context) Info(msg string)
- func (ctx *Context) Infof(format string, args ...interface{})
- func (ctx *Context) Logger() *logging.Logger
- func (ctx *Context) Panic(msg string)
- func (ctx *Context) Warn(msg string)
- func (ctx *Context) Warnf(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
Context is an extension of Go's context which also includes a logger. This allows us to pass round a contextual logger while retaining type-safety
func Background ¶
func Background() *Context
Background creates an empty context with a default logger. It is analogous to context.Background()
func ErrGroup ¶
ErrGroup returns a new Error Group and an associated Context derived from ctx. It is analogous to errgroup.WithContext(ctx)
func FromGrpcCtx ¶
FromGrpcCtx Converts a context.Context to an armadacontext.Context
func TODO ¶
func TODO() *Context
TODO creates an empty context with a default logger. It is analogous to context.TODO()
func WithCancel ¶
func WithCancel(parent *Context) (*Context, context.CancelFunc)
WithCancel returns a copy of parent with a new Done channel. It is analogous to context.WithCancel()
func WithDeadline ¶
WithDeadline returns a copy of the parent context with the deadline adjusted to be no later than d. It is analogous to context.WithDeadline()
func WithLogField ¶
WithLogField returns a copy of parent with the supplied key-value added to the logger
func WithLogFields ¶
WithLogFields returns a copy of parent with the supplied key-values added to the logger
func WithTimeout ¶
WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). It is analogous to context.WithTimeout()
func WithValue ¶
WithValue returns a copy of parent in which the value associated with key is val. It is analogous to context.WithValue()
func (*Context) Fatal ¶ added in v0.16.2
Fatal logs a message at level Fatal then the process will exit with status set to 1.