mac
2023-10-09 a59bbb7890e107a681f677765f2600e278c06a0d
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
package com.hdl.photovoltaic.other;
 
import android.util.Log;
 
/**
 * 日志逻辑
 */
public class HdlLogLogic {
 
 
    /**
     * 是否需要打印(true不需要打印)
     */
    public static boolean isDebug = false;
 
    private static volatile HdlLogLogic sHdlLogLogic;
 
    /**
     * 获取当前对象
     *
     * @return HdlLogLogic
     */
    public static synchronized HdlLogLogic getInstance() {
        if (sHdlLogLogic == null) {
            synchronized (HdlLogLogic.class) {
                if (sHdlLogLogic == null) {
                    sHdlLogLogic = new HdlLogLogic();
                }
            }
        }
        return sHdlLogLogic;
    }
 
    /**
     * android打印
     *
     * @param tag 标签
     * @param mgs 输出信息
     */
    public static void print(String tag, String mgs) {
        if (isDebug) {
            return;
        }
        Log.d(tag, mgs);
    }
 
    /**
     * java打印
     *
     * @param mgs 输出信息
     */
    public static void print(String mgs) {
        if (isDebug) {
            return;
        }
        System.out.println(mgs);
    }
 
}