wjc
2023-08-21 0a18a8180bc6040c941b07df1be1f7b726b4c155
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
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;
    }
 
    public static void print(String tag, String mgs) {
        if (isDebug) {
            return;
        }
        Log.d(tag, mgs);
    }
 
    public static void print(String mgs) {
        if (isDebug) {
            return;
        }
        System.out.println(mgs);
    }
 
}