package com.inspect.system.base.factory;

import com.inspect.base.core.domain.Response;
import com.inspect.system.base.RemoteLogService;
import com.inspect.system.base.domain.SysLoginFor;
import com.inspect.system.base.domain.SysOperateLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogService> {
   private static final Logger log = LoggerFactory.getLogger(RemoteLogFallbackFactory.class);

   public RemoteLogService create(Throwable throwable) {
      log.error("日志服务调用失败:{}", throwable.getMessage());
      return new RemoteLogService() {
         public Response<Boolean> saveLog(SysOperateLog sysOperateLog, String source) {
            return null;
         }

         public Response<Boolean> saveLogininfor(SysLoginFor sysLoginFor, String source) {
            return null;
         }
      };
   }
}
