LogUtil

import android.util.Log;

public class LogUtil {

    public static final int VERBOSE = 5;
    public static final int DEBUG = 4;
    public static final int INFO = 3;
    public static final int WARN = 2;
    public static final int ERROR = 1;

    /** 通过改变该值来进行不同级别的Log打印,上线的时将该值改为0来关闭所有log打印 */
    public final static int LOG_LEVEL = 6;

    public static void v(String tag, String msg) {
        if (LOG_LEVEL > VERBOSE && Momo.isOpenLog) {
            Log.v(tag, msg);
        }
    }

    public static void d(String tag, String msg) {
        if (LOG_LEVEL > DEBUG  && Momo.isOpenLog) {
            Log.d(tag, msg);
        }
    }

    public static void i(String tag, String msg) {
        if (LOG_LEVEL > INFO  && Momo.isOpenLog) {
            Log.i(tag, msg);
        }
    }

    public static void w(String tag, String msg) {
        if (LOG_LEVEL > WARN  && Momo.isOpenLog) {
            Log.w(tag, msg);
        }
    }

    public static void e(String tag, String msg) {
        if (LOG_LEVEL > ERROR  && Momo.isOpenLog) {
            Log.e(tag, msg);
        }
    }
}

你可能感兴趣的:(android,log)