Example usage for android.util Log v

List of usage examples for android.util Log v

Introduction

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

Prototype

public static int v(String tag, String msg) 

Source Link

Document

Send a #VERBOSE log message.

Usage

From source file:Main.java

public static String readFromFile(String path) {
    String str = null;//from   w w w.j a  va 2 s  . co  m
    if (path == null || path.trim().length() == 0) {
        return null;
    }

    File file = new File(path);

    if (file.exists() && file.isFile()) {
        int filelength = (int) file.length();
        byte[] filecontent = new byte[filelength];
        try {
            FileInputStream in = new FileInputStream(file);
            in.read(filecontent);
            in.close();
            str = new String(filecontent, "UTF-8");

        } catch (Exception e) {
            Log.v(TAG, "read file is error");
            return null;
        }

    }
    return str;
}

From source file:Main.java

public static void debug(String message, Object... args) {
    Log.v(DEBUG_TAG, String.format(message, args));
}

From source file:Main.java

public static void writeInputStreamToFile(InputStream is, String fileName, Context context)
        throws FileNotFoundException, IOException {

    FileOutputStream fos = null;/*w  w  w.  j  a v a 2 s .c  om*/

    try {
        fos = context.openFileOutput(fileName, Context.MODE_PRIVATE);
        byte buf[] = new byte[1024];
        int len = 0;
        while ((len = is.read(buf)) > 0) {
            fos.write(buf, 0, len);
        }
        fos.close();

    } catch (Exception exp) {
        Log.v(TAG, "Failed to write to file exp:" + exp.getMessage());
        exp.printStackTrace();
    }
}

From source file:Main.java

public static void dumpRect(RectF rect, String msg) {
    Log.v(TAG, msg + "=(" + rect.left + "," + rect.top + "," + rect.right + "," + rect.bottom + ")");
}

From source file:Main.java

/**
 * Makes a GET call to the server./*from  w ww .j  a  v a2 s  .c  om*/
 * @return The serve response (expected is JSON)
 */
public static String httpGet(String urlStr) {
    try {
        URL url = new URL(urlStr);

        HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
        InputStream in = new BufferedInputStream(urlConnection.getInputStream());
        String r = readStream(in);
        urlConnection.disconnect();
        return r;
    } catch (MalformedURLException e) {
        Log.v("MyLog", "GET: Bad URL");
        e.printStackTrace();
        return "GET: Bad URL";
    } catch (IOException e) {
        Log.v("MyLog", "GET: Bad Con");
        e.printStackTrace();
        return "GET: Bad Con [" + urlStr + "]";
    }
}

From source file:Main.java

public static void v(String tag, String message) {
    if (LEVEL <= VERBOSE) {
        StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[3];
        if (TextUtils.isEmpty(tag)) {
            tag = getDefaultTag(stackTraceElement);
        }/*from w w w  . ja va  2  s .c om*/
        Log.v(tag, getLogInfo(stackTraceElement) + message);
    }
}

From source file:Main.java

public static void cdlLog(String TAG, String msg) {
    if (DEVMODE == true) {
        Log.v(TAG, msg);
    }
}

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  v  a 2  s . c om*/
    }
}

From source file:Main.java

public static void log(Object object, String msg, boolean debug, int level) {
    if (level < CURRENT_DEBUG_LEVEL) {
        return;//from w ww  . j av a 2s .c  om
    } else {
        if (DEBUG && debug) {
            String name = object.getClass().getSimpleName();
            switch (level) {
            case DEBUG_LEVEL_VERBOSE:
                Log.v(TAG, name + ": " + msg);
                break;
            case DEBUG_LEVEL_DEBUG:
                Log.d(TAG, name + ": " + msg);
                break;
            case DEBUG_LEVEL_ERROR:
                Log.e(TAG, name + ": " + msg);
                break;
            default:
                break;
            }
        }
    }
}

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);
    }//from ww w  . j av  a 2  s . c  o m
}