Java Code Examples for android.util.Log.DEBUG

The following are Jave code examples for showing how to use DEBUG of the android.util.Log class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: AndroidBlueprints   File: MyApplication.java   Source Code and License Vote up 6 votes
@Override
protected void log(int priority, String tag, String message, Throwable throwable) {
    if (priority == Log.VERBOSE || priority == Log.DEBUG) {
        return;
    }

    FakeCrashLibrary.log(priority, tag, message);

    if (throwable != null) {
        if (priority == Log.ERROR) {
            FakeCrashLibrary.logError(throwable);
        } else if (priority == Log.WARN) {
            FakeCrashLibrary.logWarning(throwable);
        }
    }
}
 
Example 2
Project: GitHub   File: SingleRequest.java   Source Code and License Vote up 6 votes
/**
 * Internal {@link #onResourceReady(Resource, DataSource)} where arguments are known to be safe.
 *
 * @param resource original {@link Resource}, never <code>null</code>
 * @param result   object returned by {@link Resource#get()}, checked for type and never
 *                 <code>null</code>
 */
private void onResourceReady(Resource<R> resource, R result, DataSource dataSource) {
  // We must call isFirstReadyResource before setting status.
  boolean isFirstResource = isFirstReadyResource();
  status = Status.COMPLETE;
  this.resource = resource;

  if (glideContext.getLogLevel() <= Log.DEBUG) {
    Log.d(GLIDE_TAG, "Finished loading " + result.getClass().getSimpleName() + " from "
        + dataSource + " for " + model + " with size [" + width + "x" + height + "] in "
        + LogTime.getElapsedMillis(startTime) + " ms");
  }

  if (requestListener == null
      || !requestListener.onResourceReady(result, model, target, dataSource, isFirstResource)) {
    Transition<? super R> animation =
        animationFactory.build(dataSource, isFirstResource);
    target.onResourceReady(result, animation);
  }

  notifyLoadSuccess();
}
 
Example 3
Project: fast_face_android   File: DebugLogFileTree.java   Source Code and License Vote up 6 votes
public String getPriorityString(int priority) {
    if (priority == Log.ASSERT) {
        return "A";
    } else if (priority == Log.ERROR) {
        return "E";
    } else if (priority == Log.WARN) {
        return "W";
    } else if (priority == Log.INFO) {
        return "I";
    } else if (priority == Log.DEBUG) {
        return "D";
    } else if (priority == Log.VERBOSE) {
        return "V";
    }
    return "";
}
 
Example 4
Project: superglue   File: LumberYard.java   Source Code and License Vote up 6 votes
public String displayLevel() {
  switch (level) {
    case Log.VERBOSE:
      return "V";
    case Log.DEBUG:
      return "D";
    case Log.INFO:
      return "I";
    case Log.WARN:
      return "W";
    case Log.ERROR:
      return "E";
    case Log.ASSERT:
      return "A";
    default:
      return "?";
  }
}
 
Example 5
Project: javaide   File: LogLineAdapterUtil.java   Source Code and License Vote up 6 votes
public static int getBackgroundColorForLogLevel(Context context, int logLevel) {
    int result = android.R.color.black;
    switch (logLevel) {
        case Log.DEBUG:
            result = R.color.background_debug;
            break;
        case Log.ERROR:
            result = R.color.background_error;
            break;
        case Log.INFO:
            result = R.color.background_info;
            break;
        case Log.VERBOSE:
            result = R.color.background_verbose;
            break;
        case Log.WARN:
            result = R.color.background_warn;
            break;
        case LOG_WTF:
            result = R.color.background_wtf;
            break;
    }

    return ContextCompat.getColor(context,result);
}
 
Example 6
Project: javaide   File: LogLine.java   Source Code and License Vote up 6 votes
private static char convertLogLevelToChar(int logLevel) {

        switch (logLevel) {
            case Log.DEBUG:
                return 'D';
            case Log.ERROR:
                return 'E';
            case Log.INFO:
                return 'I';
            case Log.VERBOSE:
                return 'V';
            case Log.WARN:
                return 'W';
            case LogLineAdapterUtil.LOG_WTF:
                return 'F';
        }
        return ' ';
    }
 
Example 7
Project: RxShell   File: JUnitTree.java   Source Code and License Vote up 6 votes
private static String priorityToString(int priority) {
    switch (priority) {
        case Log.ERROR:
            return "E";
        case Log.WARN:
            return "W";
        case Log.INFO:
            return "I";
        case Log.DEBUG:
            return "D";
        case Log.VERBOSE:
            return "V";
        default:
            return String.valueOf(priority);
    }
}
 
Example 8
Project: javaide   File: LogLineAdapterUtil.java   Source Code and License Vote up 6 votes
public static int getForegroundColorForLogLevel(Context context, int logLevel) {
    int result = android.R.color.primary_text_dark;
    switch (logLevel) {
        case Log.DEBUG:
            result = R.color.foreground_debug;
            break;
        case Log.ERROR:
            result = R.color.foreground_error;
            break;
        case Log.INFO:
            result = R.color.foreground_info;
            break;
        case Log.VERBOSE:
            result = R.color.foreground_verbose;
            break;
        case Log.WARN:
            result = R.color.foreground_warn;
            break;
        case LOG_WTF:
            result = R.color.foreground_wtf;
            break;
    }
    return ContextCompat.getColor(context,result);
}
 
Example 9
Project: TMvpSimple   File: LogUtils.java   Source Code and License Vote up 6 votes
/**
 * Send a {@link #DEBUG_LEVEL} log message.
 *
 * @param object The object to print.
 */
public static void print(Object object) {
    if (Log.DEBUG > DEBUG_LEVEL) {
        String tag = getClassName();
        String method = callMethodAndLine();
        String content = "";
        if (object != null) {
            content = object.toString() + "                    ----    "
                    + method;
        } else {
            content = " ## " + "                ----    " + method;
        }
        Log.d(tag, content);
        if (DEBUG_SYSOUT) {
            System.out.println(tag + "  " + content + "  " + method);
        }
    }
}
 
Example 10
Project: TMvpSimple-master   File: LogUtils.java   Source Code and License Vote up 5 votes
/**
 * Send a {@link #DEBUG_LEVEL} log message.
 *
 * @param obj
 */
public static void d(Object obj) {
    if (Log.DEBUG > DEBUG_LEVEL) {
        String tag = getClassName();
        String msg = obj != null ? obj.toString() : "obj == null";
        Log.d(tag, msg);
    }
}
 
Example 11
Project: Architecture   File: App.java   Source Code and License Vote up 5 votes
@Override protected void log(int priority, String tag, String message, Throwable t) {
  if (priority == Log.VERBOSE || priority == Log.DEBUG) {
    return;
  }

  Log.println(priority, tag, message);

  if (t != null) {
    if (priority == Log.ERROR) {
      Log.e(tag, message, t);
    } else if (priority == Log.WARN) {
      Log.w(tag, message, t);
    }
  }
}
 
Example 12
Project: GitHub   File: ExampleApp.java   Source Code and License Vote up 5 votes
@Override protected void log(int priority, String tag, @NonNull String message, Throwable t) {
  if (priority == Log.VERBOSE || priority == Log.DEBUG) {
    return;
  }

  FakeCrashLibrary.log(priority, tag, message);

  if (t != null) {
    if (priority == Log.ERROR) {
      FakeCrashLibrary.logError(t);
    } else if (priority == Log.WARN) {
      FakeCrashLibrary.logWarning(t);
    }
  }
}
 
Example 13
Project: MyBlogPost   File: Logger.java   Source Code and License Vote up 5 votes
public static void log(int mode, String message, String tag) {

        if (!BuildConfig.DEBUG)
            return;

        if (message == null)
            return;

        if (tag == null)
            tag = "";

        if (message.trim().length() == 0)
            message = "Data Empty";

        if (ENABLE_LONG_LOG) {
            longLog(mode, tag, message);
        } else {
            if (mode == Log.DEBUG) {
                Log.d(TAG + tag, message);
            } else if (mode == Log.ERROR) {
                Log.e(TAG + tag, message);
            } else if (mode == Log.INFO) {
                Log.i(TAG + tag, message);
            } else if (mode == Log.WARN) {
                Log.w(TAG + tag, message);
            }
        }
    }
 
Example 14
Project: FinalProject   File: ReleaseTree.java   Source Code and License Vote up 5 votes
@Override
protected boolean isLoggable(int priority){
    if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) {
        return false;
    }
    //only when WARN, WTF, ERROR
    return true;
}
 
Example 15
Project: browser   File: LogUtil.java   Source Code and License Vote up 5 votes
private static void print(int mode, final String tag, String msg) {
	if (!isPrint) {
		return;
	}
	if (msg == null) {
		Log.e(tag, MSG);
		return;
	}
	switch (mode) {
	case Log.VERBOSE:
		Log.v(tag, msg);
		break;
	case Log.DEBUG:
		Log.d(tag, msg);
		break;
	case Log.INFO:
		Log.i(tag, msg);
		break;
	case Log.WARN:
		Log.w(tag, msg);
		break;
	case Log.ERROR:
		Log.e(tag, msg);
		break;
	default:
		Log.d(tag, msg);
		break;
	}
}
 
Example 16
Project: InstantAppStarter   File: ReleaseTree.java   Source Code and License Vote up 5 votes
@Override
protected boolean isLoggable(String tag, int priority) {
    if(priority == Log.VERBOSE || priority == Log.DEBUG || priority==Log.INFO){
        return false;
    }
    return true;
}
 
Example 17
Project: publicProject   File: CommonLog.java   Source Code and License Vote up 4 votes
public static void d(String msg) {
	if (LOG_LEVEL > Log.DEBUG) {
		Log.i(LOG_TAG, msg);
	}
}
 
Example 18
Project: publicProject   File: CommonLog.java   Source Code and License Vote up 4 votes
public static void e(String msg) {
	if (LOG_LEVEL > Log.DEBUG) {
		Log.e(LOG_TAG, msg);
	}
}
 
Example 19
Project: PrivacyStreams   File: Logging.java   Source Code and License Vote up 4 votes
public static void debug(String message) {
    if (Globals.LoggingConfig.isEnabled && Globals.LoggingConfig.level <= Log.DEBUG) {
        Log.d(Consts.LIB_TAG, message);
    }
}
 
Example 20
Project: UltimateAndroidReference   File: Logger.java   Source Code and License Vote up 4 votes
private Logger(String TAG) {
  this.TAG = TAG;
  this.priority = Log.DEBUG;
}