package util import "context" type contextKey int const initKey contextKey = 0 // NewContext adds a *NSILogger structure to a context and returns the new context func NewInitContext(ctx context.Context, lag *Init) context.Context { return context.WithValue(ctx, initKey, lag) } // FromContext extracts a *NSILogger structure from a context and returns the structure func FromInitContext(ctx context.Context) *Init { return ctx.Value(initKey).(*Init) }