package com.hdl.linkpm.sdk.utils;
|
|
import android.text.TextUtils;
|
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSONObject;
|
import com.google.gson.JsonObject;
|
import com.hdl.linkpm.sdk.core.exception.HDLException;
|
import com.hdl.linkpm.sdk.core.exception.HDLLinkCopyException;
|
import com.hdl.log.enums.Level;
|
import com.hdl.log.utils.LogUtil;
|
|
/**
|
* Created by Zoro
|
* Created on 2023/4/7
|
* description:
|
*/
|
public class HDLExceptionSubmitUtils {
|
public static void submit(String requestUrl, JsonObject json, HDLException e) {
|
try {
|
LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params:" + HDLGsonUtils.toJson(json), null, Level.high);
|
} catch (Exception e1) {
|
|
}
|
}
|
|
public static void submit(String requestUrl, JsonObject json, Throwable e) {
|
try {
|
LogUtil.log(requestUrl, "code:" + e.getMessage() + "--msg:" + e.getMessage() + "--params:" + HDLGsonUtils.toJson(json), null, Level.high);
|
} catch (Exception e1) {
|
|
}
|
}
|
|
public static void submit(String requestUrl, Object json, HDLException e) {
|
try {
|
LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params:" + HDLGsonUtils.toJson(json), null, Level.high);
|
} catch (Exception e1) {
|
}
|
}
|
|
public static void submit(String requestUrl, Object json, HDLLinkCopyException e) {
|
try {
|
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(json));
|
String utfStr = "";
|
if (jsonObject != null) {
|
try {
|
byte[] data = jsonObject.getBytes("data");
|
utfStr = new String(data);
|
} catch (Exception e1) {
|
|
}
|
}
|
if (!TextUtils.isEmpty(utfStr)) {
|
LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params:" + HDLGsonUtils.toJson(json) + "--utf-8:" + utfStr, null, Level.high);
|
} else {
|
LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params:" + HDLGsonUtils.toJson(json), null, Level.high);
|
|
}
|
} catch (Exception e1) {
|
|
}
|
}
|
|
}
|