Example usage for android.util Log isLoggable

List of usage examples for android.util Log isLoggable

Introduction

In this page you can find the example usage for android.util Log isLoggable.

Prototype

public static native boolean isLoggable(String tag, int level);

Source Link

Document

Checks to see whether or not a log for the specified tag is loggable at the specified level.

Usage

From source file:Main.java

public static void LOGD(final String tag, String message) {
    if (LOGGING_ENABLED) {
        if (Log.isLoggable(tag, Log.DEBUG)) {
            Log.d(tag, message);/*from  w  w  w . j a v  a 2  s.  c  o  m*/
        }
    }
}

From source file:Main.java

public static void LOGD(final String tag, String message, Throwable cause) {
    if (LOGGING_ENABLED) {
        if (Log.isLoggable(tag, Log.DEBUG)) {
            Log.d(tag, message, cause);/*  ww w. ja  v a 2 s. co m*/
        }
    }
}

From source file:Main.java

/**
 * debug log//from w  w  w.j  a  v  a 2  s . c  om
 * @param tag tag
 * @param msg log msg
 */
public static void d(String tag, String msg) {
    if (LOG_ENABLE && Log.isLoggable(tag, Log.DEBUG)) {
        Log.d(tag, buildMsg(msg));
    }
}

From source file:Main.java

public static File getPhotoCacheDir(Context context, File file) {
    File cacheDir = context.getCacheDir();
    if (cacheDir != null) {
        File mCacheDir = new File(cacheDir, DEFAULT_DISK_CACHE_DIR);
        if (!mCacheDir.mkdirs() && (!mCacheDir.exists() || !mCacheDir.isDirectory())) {
            return file;
        } else {/*from  w  w  w. jav a 2s  .co m*/
            return new File(mCacheDir, file.getName());
        }
    }
    if (Log.isLoggable(TAG, Log.ERROR)) {
        Log.e(TAG, "default disk cache dir is null");
    }
    return file;
}

From source file:Main.java

private static boolean isPropertyEnabled(String propertyName) {
    return Log.isLoggable(propertyName, Log.VERBOSE);
}

From source file:Main.java

/**
 * A simple wrapper around LOGD/*w  ww  .j a va 2  s . c o m*/
 */
public static final void LOGD(String TAG, String message) {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, message);
    }
}

From source file:Main.java

public static void LOGV(final String tag, String message) {
    if (LOGGING_ENABLED) {
        if (Log.isLoggable(tag, Log.VERBOSE)) {
            Log.v(tag, message);//from  w  w  w . j  a va 2s. c  om
        }
    }
}

From source file:Main.java

public static void LOGV(final String tag, String message) {
    //noinspection PointlessBooleanExpression,ConstantConditions
    if (debug && Log.isLoggable(tag, Log.VERBOSE)) {
        Log.v(tag, message);//  w  w w .j a  va  2s.  co  m
    }
}

From source file:Main.java

public static void LOGD(final String tag, String message) {
    //noinspection PointlessBooleanExpression,ConstantConditions
    if (debug || Log.isLoggable(tag, Log.DEBUG)) {
        Log.d(tag, message);/*  ww  w. j  a  v a  2  s.co  m*/
    }
}

From source file:Main.java

public static void log(String tag, int level, Throwable t, Object... messages) {
    if (Log.isLoggable(tag, level)) {
        String message;/*from w  w  w  . java 2 s.c o  m*/
        if (t == null && messages != null && messages.length == 1) {
            // handle this common case without the extra cost of creating a stringbuffer:
            message = messages[0].toString();
        } else {
            StringBuilder sb = new StringBuilder();
            if (messages != null)
                for (Object m : messages) {
                    sb.append(m);
                }
            if (t != null) {
                sb.append("\n").append(Log.getStackTraceString(t));
            }
            message = sb.toString();
        }
        Log.println(level, tag, message);
    }
}