public class BWLog {

    public static boolean LOG_DEBUG = false;

    public static void d(String msg) {
        if (LOG_DEBUG) {
            if (TextUtils.isEmpty(msg)) {
                return;
            }
            SHLog.d("baiwanlu", msg);
        }
    }

    public static void d(Object... messages) {
        if (LOG_DEBUG) {
            StringBuilder stringBuilder = new StringBuilder();
            for (Object msg : messages) {
                if (null == msg) {
                    continue;
                }
                stringBuilder.append(msg.toString());
            }
            if (stringBuilder.length() > 0) {
                SHLog.d("baiwanlu", stringBuilder.toString());
            }
        }
    }

    public static void d(String tag, String msg) {
        if (LOG_DEBUG) {
            if (TextUtils.isEmpty(msg)) {
                return;
            }

            Log.d(tag, Thread.currentThread().toString() + ":");

            Log.d(tag, msg);
        }
    }

    public static void e(String tag, String msg) {
        if (LOG_DEBUG) {
            if (TextUtils.isEmpty(msg)) {
                return;
            }

            Log.e(tag, Thread.currentThread().toString() + ":");

            Log.e(tag, msg);
        }
    }

    public static void e(String... messages) {
        if (LOG_DEBUG) {
            StringBuilder stringBuilder = new StringBuilder();
            for (String msg : messages) {
                stringBuilder.append(msg);
            }
            SHLog.e("baiwanlu", stringBuilder.toString());
        }
    }

    public static void e(String tag, Throwable throwable) {
        if (LOG_DEBUG) {
            Log.e(tag, Thread.currentThread().toString(), throwable);
        }
    }

    public static void e(Throwable throwable) {
        if (LOG_DEBUG) {
            SHLog.e("baiwanlu", throwable);
        }
    }

}

标签: none

添加新评论