package com.sptg.permissions.api.feigns.fallback;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.common.core.constant.CommonConstant;
import com.sptg.permissions.api.entity.ApiLog;
import com.sptg.permissions.api.entity.Conf;
import com.sptg.permissions.api.feigns.ConfFeign;
import com.sptg.permissions.api.feigns.SysApiLogFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * title: ConfFeignFallbackFactority
 * package: com.sptg.permissions.api.feigns.fallback
 * description:
 *
 *                  
 *                
 */
@Component
@Slf4j
public class SysApiLogFeignFallbackFactory implements FallbackFactory<SysApiLogFeign> {

    @Override
    public SysApiLogFeign create(Throwable cause) {
        return new SysApiLogFeign() {

            @Override
            public ResultBean<Boolean> create(ApiLog apiLog) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }
        };
    }
}
