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