func logged(next endpoint.Endpoint) endpoint.Endpoint {
	return func(ctx context.Context, request interface{}) (response interface{}, err error) {
		res, err := next(ctx, request)
		if err != nil {
			logging.WithErr(ctx, err)
			return nil, err
		}
		if errResp, ok := res.(errorer); ok {
			err = errResp.error()
			if err != nil {
				logging.WithErr(ctx, err)
			}
		}
		return res, nil
	}
}
// logged wraps an endpoint and adds the error if the context supports it
logged wraps an endpoint and adds the error if the context supports it
// logged wraps an endpoint and adds the error if the context supports it
func logged(next endpoint.Endpoint) endpoint.Endpoint {
	return func(ctx context.Context, request interface{}) (response interface{}, err error) {
		res, err := next(ctx, request)
		if err != nil {
			logging.WithErr(ctx, err)
			return nil, err
		}
		if errResp, ok := res.(errorer); ok {
			err = errResp.error()
			if err != nil {
				logging.WithErr(ctx, err)
			}
		}
		return res, nil
	}
}
func logged ( next endpoint . Endpoint ) endpoint . Endpoint { return func ( ctx context . Context , request interface { } ) ( response interface { } , err error ) { res , err := next ( ctx , request ) if err != nil { logging . WithErr ( ctx , err ) return nil , err } if errResp , ok := res . ( errorer ) ; ok { err = errResp . error ( ) if err != nil { logging . WithErr ( ctx , err ) } } return res , nil } }
logged wraps an endpoint and adds the error if the context supports it
logged wraps an endpoint and adds the error if the context supports it