hxb
2024-02-23 a6c0ac0f20d1d91fbe1fe591a6a9ca46f82399f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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) {
 
        }
    }
 
}