Android Open Source - Demo-YouTuBe-Android Log Util






From Project

Back to project page Demo-YouTuBe-Android.

License

The source code is released under:

Apache License

If you think the Android project Demo-YouTuBe-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.lqg.youtube.support.util;
// w ww.  ja v  a  2  s. co  m

public class LogUtil {

    private static final String DefaultTag = "YouTuBe";
    private static final boolean DEBUG = true;

    public static void v(String msg) {
        if (DEBUG)
            android.util.Log.v(DefaultTag, buildMessage(msg));
    }

    public static void v(String msg, Throwable thr) {
        if (DEBUG)
            android.util.Log.v(DefaultTag, buildMessage(msg), thr);
    }

    public static void d(Object msg) {
        if (DEBUG)
            android.util.Log.d(DefaultTag, buildMessage(msg + ""));
    }

    public static void d(String msg) {
        if (DEBUG)
            android.util.Log.d(DefaultTag, buildMessage(msg));
    }

    public static void d(String msg, Throwable thr) {
        if (DEBUG)
            android.util.Log.d(DefaultTag, buildMessage(msg), thr);
    }

    public static void d(String tag, String msg) {
        if (DEBUG)
            android.util.Log.d(tag, buildMessage(msg));
    }

    public static void i(String msg) {
        if (DEBUG)
            android.util.Log.i(DefaultTag, buildMessage(msg));
    }

    public static void i(String msg, Throwable thr) {
        if (DEBUG)
            android.util.Log.i(DefaultTag, buildMessage(msg), thr);
    }

    public static void e(String msg) {
        if (DEBUG)
            android.util.Log.e(DefaultTag, buildMessage(msg));
    }

    public static void e(String msg, Throwable thr) {
        if (DEBUG)
            android.util.Log.e(DefaultTag, buildMessage(msg), thr);
    }

    public static void w(String msg) {
        if (DEBUG)
            android.util.Log.w(DefaultTag, buildMessage(msg));
    }

    public static void w(String msg, Throwable thr) {
        if (DEBUG)
            android.util.Log.w(DefaultTag, buildMessage(msg), thr);
    }

    public static void w(Throwable thr) {
        if (DEBUG)
            android.util.Log.w(DefaultTag, buildMessage(""), thr);
    }

    protected static String buildMessage(String msg) {
        StackTraceElement caller = new Throwable().fillInStackTrace().getStackTrace()[2];

        return new StringBuilder()
                .append(caller.getClassName())
                .append(".")
                .append(caller.getMethodName())
                .append("(): ")
                .append(msg).toString();
    }
}




Java Source Code List

com.lqg.youtube.support.GlobalApplication.java
com.lqg.youtube.support.http.Search.java
com.lqg.youtube.support.player.Format.java
com.lqg.youtube.support.player.UrlParser.java
com.lqg.youtube.support.player.VideoId.java
com.lqg.youtube.support.player.VideoStream.java
com.lqg.youtube.support.util.ImageLoaderUtil.java
com.lqg.youtube.support.util.LogUtil.java
com.lqg.youtube.support.util.SearchSetting.java
com.lqg.youtube.ui.play.PlayVideoUsingVideoViewActivity.java
com.lqg.youtube.ui.play.PlayVideoUsingYouTuBeActivity.java
com.lqg.youtube.ui.search.MainActivity.java
com.lqg.youtube.ui.search.SearchFragment.java
com.lqg.youtube.ui.search.SearchResultAdapter.java
com.lqg.youtube.ui.search.SearchSetingFragment.java