mirror of https://gitee.com/stylefeng/roses
【8.0】【log】更新业务日志工具类
parent
71de2bb759
commit
9504ac90aa
|
@ -0,0 +1,50 @@
|
|||
package cn.stylefeng.roses.kernel.log.business.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.stylefeng.roses.kernel.log.business.context.BusinessLogHolder;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
|
||||
/**
|
||||
* 业务日志
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/7/21 18:35
|
||||
*/
|
||||
public class BusinessLogUtil {
|
||||
|
||||
/**
|
||||
* 设置日志的摘要信息,便于后台搜索
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/7/21 17:30
|
||||
*/
|
||||
public static void setLogTitle(String logTitle) {
|
||||
if (StrUtil.isEmpty(logTitle)) {
|
||||
return;
|
||||
}
|
||||
BusinessLogHolder.setLogTitle(logTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加日志记录
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/7/21 16:53
|
||||
*/
|
||||
public static void addContent(Object... contentObject) {
|
||||
if (ObjectUtil.isEmpty(contentObject)) {
|
||||
return;
|
||||
}
|
||||
StringBuilder stringBuffer = new StringBuilder();
|
||||
for (Object param : contentObject) {
|
||||
if (param instanceof String) {
|
||||
stringBuffer.append(param);
|
||||
} else {
|
||||
stringBuffer.append(JSON.toJSONString(param));
|
||||
}
|
||||
}
|
||||
BusinessLogHolder.addContent(stringBuffer.toString());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue