当前位置: 首页>>代码示例>>Java>>正文


Java Log.WARN属性代码示例

本文整理汇总了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);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:24,代码来源:LogLineAdapterUtil.java

示例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);
    }
}
 
开发者ID:d4rken,项目名称:RxShell,代码行数:16,代码来源:JUnitTree.java

示例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);
        }
    }
}
 
开发者ID:davideas,项目名称:AndroidBlueprints,代码行数:16,代码来源:MyApplication.java

示例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 "";
}
 
开发者ID:gicheonkang,项目名称:fast_face_android,代码行数:16,代码来源:DebugLogFileTree.java

示例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;
    }
}
 
开发者ID:roshakorost,项目名称:Phial,代码行数:35,代码来源:PhialLogger.java

示例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;
  }
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:16,代码来源:LogAdapter.java

示例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));
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:SingleRequest.java

示例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);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:AndroidPlatform.java

示例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();
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:11,代码来源:FileDownloadLog.java

示例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;
	}
}
 
开发者ID:Louis19910615,项目名称:youkes_browser,代码行数:29,代码来源:LogUtil.java

示例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);
    }
}
 
开发者ID:Xianicai,项目名称:TMvpSimple-master,代码行数:12,代码来源:LogUtils.java

示例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);
            }
        }
    }
 
开发者ID:qornanali,项目名称:MyBlogPost,代码行数:28,代码来源:Logger.java

示例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();
		}
	}
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:14,代码来源:Logger.java

示例14: isLoggable

protected boolean isLoggable(int priority) {
    switch (priority) {
        case Log.ERROR:
        case Log.WARN:
            return true;

        default:
            return false;
    }
}
 
开发者ID:aprochukhan,项目名称:Android-MVVM-Example,代码行数:10,代码来源:ReleaseTree.java

示例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();
        }
    }
 
开发者ID:killnono,项目名称:Dalaran,代码行数:39,代码来源:LogUtils.java


注:本文中的android.util.Log.WARN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。