fix
This commit is contained in:
parent
c25245dbd8
commit
ca5fffd70a
@ -1,9 +1,11 @@
|
||||
package com.flyfish.framework.logging.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.flyfish.framework.logging.config.LoggingTextRegistry;
|
||||
import com.flyfish.framework.logging.domain.Log;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -24,6 +26,8 @@ public class LogManager implements DisposableBean {
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
|
||||
@Resource
|
||||
private LogService logService;
|
||||
@Resource
|
||||
private LoggingTextRegistry registry;
|
||||
|
||||
/**
|
||||
* 尝试记录日志
|
||||
@ -37,7 +41,10 @@ public class LogManager implements DisposableBean {
|
||||
log.setSuccess(context.isSuccess());
|
||||
log.setBody(bodyString(context.getArgs()));
|
||||
log.setModule(context.getModule());
|
||||
log.setBusiness(context.getBusiness());
|
||||
log.setBusiness(Optional.ofNullable(context.getBusiness())
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.map(registry::text)
|
||||
.orElse(context.getBusiness()));
|
||||
log.setError(Optional.ofNullable(context.getError()).map(JSON::toJSONString).orElse(null));
|
||||
log.setResponse(Optional.ofNullable(context.getResult()).map(JSON::toJSONString).orElse(null));
|
||||
log.setOperator(context.getUser());
|
||||
|
Loading…
Reference in New Issue
Block a user