本文整理汇总了Java中android.util.Log.WARN属性的典型用法代码示例。如果您正苦于以下问题:Java Log.WARN属性的具体用法?Java Log.WARN怎么用?Java Log.WARN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.util.Log
的用法示例。
在下文中一共展示了Log.WARN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getForegroundColorForLogLevel
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);
}
示例2: priorityToString
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);
}
}
示例3: log
@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);
}
}
}
示例4: getPriorityString
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 "";
}
示例5: log
/**
* Create new log entry in file.
* <p>
* You should not call it directly from your application build some facade (or use Timber) and set it to write to
* PhialLogger.
*
* @param priority Log level. See {@link Log} for constants.
* @param tag Explicit or inferred tag. May be {@code null}.
* @param message Formatted log message. May be {@code null}.
* @param t Accompanying exceptions. May be {@code null}.
*/
public void log(int priority, String tag, String message, Throwable t) {
final org.slf4j.Logger logger = LoggerFactory.getLogger(tag);
switch (priority) {
case Log.VERBOSE:
logger.trace(message, t);
break;
case Log.DEBUG:
logger.debug(message, t);
break;
case Log.INFO:
logger.info(message, t);
break;
case Log.WARN:
logger.warn(message, t);
break;
case Log.ERROR:
logger.error(message, t);
break;
default:
logger.error("unexpected Log priority: " + priority + " " + message, t);
break;
}
}
示例6: backgroundForLevel
public static @DrawableRes int backgroundForLevel(int level) {
switch (level) {
case Log.VERBOSE:
case Log.DEBUG:
return R.color.debug_log_accent_debug;
case Log.INFO:
return R.color.debug_log_accent_info;
case Log.WARN:
return R.color.debug_log_accent_warn;
case Log.ERROR:
case Log.ASSERT:
return R.color.debug_log_accent_error;
default:
return R.color.debug_log_accent_unknown;
}
}
示例7: begin
@Override
public void begin() {
stateVerifier.throwIfRecycled();
startTime = LogTime.getLogTime();
if (model == null) {
if (Util.isValidDimensions(overrideWidth, overrideHeight)) {
width = overrideWidth;
height = overrideHeight;
}
// Only log at more verbose log levels if the user has set a fallback drawable, because
// fallback Drawables indicate the user expects null models occasionally.
int logLevel = getFallbackDrawable() == null ? Log.WARN : Log.DEBUG;
onLoadFailed(new GlideException("Received null model"), logLevel);
return;
}
status = Status.WAITING_FOR_SIZE;
if (Util.isValidDimensions(overrideWidth, overrideHeight)) {
onSizeReady(overrideWidth, overrideHeight);
} else {
target.getSize(this);
}
if ((status == Status.RUNNING || status == Status.WAITING_FOR_SIZE)
&& canNotifyStatusChanged()) {
target.onLoadStarted(getPlaceholderDrawable());
}
if (Log.isLoggable(TAG, Log.VERBOSE)) {
logV("finished run method in " + LogTime.getElapsedMillis(startTime));
}
}
示例8: log
@Override public void log(int level, String message, Throwable t) {
int logLevel = level == WARN ? Log.WARN : Log.DEBUG;
if (t != null) message = message + '\n' + Log.getStackTraceString(t);
// Split by line, then ensure each line can fit into Log's maximum length.
for (int i = 0, length = message.length(); i < length; i++) {
int newline = message.indexOf('\n', i);
newline = newline != -1 ? newline : length;
do {
int end = Math.min(newline, i + MAX_LOG_LENGTH);
Log.println(logLevel, "OkHttp", message.substring(i, end));
i = end;
} while (i < newline);
}
}
示例9: log
private static void log(int priority, Object o, Throwable throwable, String message, Object... args) {
final boolean force = priority >= Log.WARN;
if (!force && !NEED_LOG) {
return;
}
Log.println(priority, getTag(o), FileDownloadUtils.formatString(message, args));
if (throwable != null) {
throwable.printStackTrace();
}
}
示例10: print
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;
}
}
示例11: w
/**
* Send a {@link Log#WARN} log message.
*
* @param obj
*/
public static void w(Object obj) {
if (Log.WARN > DEBUG_LEVEL) {
String tag = getClassName();
String msg = obj != null ? obj.toString() : "obj == null";
Log.w(tag, msg);
}
}
示例12: log
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);
}
}
}
示例13: w
/**
* log.d
*/
public void w(String format, Object... args) {
if (logLevel <= Log.WARN) {
lock.lock();
try {
String message = createMessage(getInputString(format, args));
Log.w(tagName, message);
} finally {
lock.unlock();
}
}
}
示例14: isLoggable
protected boolean isLoggable(int priority) {
switch (priority) {
case Log.ERROR:
case Log.WARN:
return true;
default:
return false;
}
}
示例15: log
private static void log(int level, Object o, Throwable tr) {
if (!ENABLED) return;
String trace = generateTrace();
String toast = trace.split("\\(")[0];
String message = generateMessage(o) + SEPARATOR + trace;
if (tr != null) {
message += "\n" + Log.getStackTraceString(tr);
}
switch (level) {
case Log.VERBOSE:
Log.v(TAG, message);
break;
case Log.DEBUG:
Log.d(TAG, message);
break;
case Log.INFO:
Log.i(TAG, message);
break;
case Log.WARN:
Log.w(TAG, message);
// ToastManager.show("Log.WARN\n" + toast);
break;
case Log.ERROR:
Log.e(TAG, message);
// ToastManager.show("Log.ERROR\n" + toast);
// throw new IllegalStateException(message);
break;
case Log.ASSERT:
Log.wtf(TAG, message);
// ToastManager.show("Log.ASSERT\n" + toast);
// throw new IllegalStateException(message);
break;
default:
throw new IllegalStateException();
}
}