Example usage for android.util Log d

List of usage examples for android.util Log d

Introduction

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

Prototype

public static int d(String tag, String msg) 

Source Link

Document

Send a #DEBUG log message.

Usage

From source file:Main.java

public static void log(String TAG, String message, Object... args) {
    if (DEBUG_OUTPUTS_ENABLED)
        Log.d(ID, TAG + "::" + String.format(Locale.UK, message, args));
}

From source file:Main.java

public static int[] getSchoolCalDate(int year, int month, int day, int week, int dayOfWeek) {
    Calendar cal = Calendar.getInstance();
    cal.set(year, month - 1, day);/*from   w w w . j a  va 2s .c o m*/
    Log.d(TAG, "Date: " + cal.toString());
    Log.d(TAG, "year: " + year);
    Log.d(TAG, "month: " + month);
    Log.d(TAG, "day: " + day);
    cal.add(Calendar.DATE, -offset(cal.get(Calendar.DAY_OF_WEEK)));
    int count = (week - 1) * 7 + dayOfWeek - 1;
    Log.d(TAG, "count: " + count);
    cal.add(Calendar.DATE, count);
    int result[] = { cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH) };

    return result;
}

From source file:Main.java

/**
 * <pre>/*from  w ww.  j ava2  s  . c  om*/
 * Print a very long {@link String} to logcat by splitting {@link String} object to smaller {@link String} of 4000 characters.
 * </pre>
 */
public static void logLongString(final String tag, final String str) {
    if (str.length() > 4000) {
        Log.d(tag, str.substring(0, 4000));
        logLongString(tag, str.substring(4000));
    } else {
        Log.d(tag, str);
    }
}

From source file:Main.java

public static void d(String tag, String msg) {
    if (IS_DEBUG) {
        Log.d(tag, "-->" + msg);
    }
}

From source file:Main.java

public static String getRealPathFromURI(Uri contentUri, Context ctx) {
    Log.d("thong", "Uri: " + contentUri.toString());

    try {//w ww  .  j  a  v a2 s . c o m
        String realpath = "";

        String[] proj = { MediaStore.Images.Media.DATA };

        //Cursor cursor = ((Activity) ctx).managedQuery(contentUri, proj, null, null, null);

        Cursor cursor = ctx.getContentResolver().query(contentUri, proj, null, null, null);

        Log.d("thong", "Column count: " + cursor.getColumnCount());

        int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);

        cursor.moveToFirst();

        realpath = cursor.getString(column_index);

        cursor.close();

        return realpath;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:Main.java

public static void d(String tag, String msg) {
    if (isDebug)
        Log.d(tag, msg);
}

From source file:Main.java

public static void appendLog(String text) {
    Log.d("LOGFILE", text);
    SimpleDateFormat sTime = new SimpleDateFormat("dd/MMM/yyyy - hh:mm:ss");
    String timeFormat = sTime.format(new Date());

    File sdCard = Environment.getExternalStorageDirectory();
    File dir = new File(sdCard.getAbsolutePath() + "/Cura/Logs/");
    dir.mkdirs();//from   ww w  .j a  va2 s  . com
    File logFile = new File(dir, "Cura_Logs_DEBUG.txt");
    if (!logFile.exists()) {
        try {
            logFile.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    try {
        BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true));
        if (text.compareTo("wipe") == 0)
            logFile.delete();
        else {
            buf.append("[" + timeFormat + "] - ");
            buf.append(text);
            buf.newLine();
            buf.close();
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void d(String cusPreLogStr, String logStr) {
    Log.d(TAG, cusPreLogStr + logStr);
}

From source file:Main.java

public static void printMap(Map<?, ?> m) {
    StringBuilder sb = new StringBuilder();
    for (Entry<?, ?> entry : m.entrySet()) {
        sb.append(entry.getKey()).append(": ").append(entry.getValue()).append("\r\n");
    }/*from   www .  j ava 2  s  .  c  o  m*/
    Log.d("print", sb.toString());
}

From source file:Main.java

public static int debug(String tag, String msg) {
    if (DEBUG_DEVELOPER_MODE) {
        return Log.d(tag, msg);
    } else {//  ww  w  . j  a  v  a2 s . com
        return 0;
    }
}