Documentation ¶
Overview ¶
Package context holds the last resort overrides and fyi objects that can be passed to clients and transports added to context.Context objects.
Index ¶
- func LoggerFrom(ctx context.Context) *zap.SugaredLogger
- func TargetFrom(ctx context.Context) *url.URL
- func TopicFrom(ctx context.Context) string
- func WithLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context
- func WithTarget(ctx context.Context, target string) context.Context
- func WithTopic(ctx context.Context, topic string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoggerFrom ¶
func LoggerFrom(ctx context.Context) *zap.SugaredLogger
LoggerFrom returns the logger stored in context.
func TargetFrom ¶
TargetFrom looks in the given context and returns `target` as a parsed url if found and valid, otherwise nil.
func TopicFrom ¶
TopicFrom looks in the given context and returns `topic` as a string if found and valid, otherwise "".
func WithLogger ¶
WithLogger returns a new context with the logger injected into the given context.
func WithTarget ¶
WithTarget returns back a new context with the given target. Target is intended to be transport dependent. For http transport, `target` should be a full URL and will be injected into the outbound http request.
Types ¶
This section is empty.