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


Java Log.ERROR属性代码示例

本文整理汇总了Java中android.util.Log.ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java Log.ERROR属性的具体用法?Java Log.ERROR怎么用?Java Log.ERROR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.util.Log的用法示例。


在下文中一共展示了Log.ERROR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printError

/**
 * Send an {@link Log#ERROR} log message.
 *
 * @param object The object to print.
 */
public static void printError(Object object) {
    if (Log.ERROR > DEBUG_LEVEL) {
        String tag = getClassName();
        String method = callMethodAndLine();
        String content = "";
        if (object != null) {
            content = object.toString() + "                    ----    "
                    + method;
        } else {
            content = " ## " + "                    ----    " + method;
        }
        Log.e(tag, content);
        if (DEBUG_SYSOUT) {
            System.err.println(tag + "  " + method + "  " + content);
        }
    }
}
 
开发者ID:TBoyLi,项目名称:TMvpSimple,代码行数:22,代码来源:LogUtils.java

示例2: getLogcatLinePriority

private static LogcatLine.Priority getLogcatLinePriority(int priority) {
    if (Log.VERBOSE == priority) {
        return LogcatLine.Priority.VERBOSE;
    } else if (Log.DEBUG == priority) {
        return LogcatLine.Priority.DEBUG;
    } else if (Log.INFO == priority) {
        return LogcatLine.Priority.INFO;
    } else if (Log.WARN == priority) {
        return LogcatLine.Priority.WARNING;
    } else if (Log.ERROR == priority) {
        return LogcatLine.Priority.ERROR;
    } else if (Log.ASSERT == priority) {
        return LogcatLine.Priority.ASSERT;
    } else {
        return LogcatLine.Priority.SILENT;
    }
}
 
开发者ID:Manabu-GT,项目名称:DebugOverlay-Android,代码行数:17,代码来源:TimberDataModule.java

示例3: priorityString

public static String priorityString(int priority) {
  switch (priority) {
    case Log.VERBOSE:
      return "VERBOSE";
    case Log.DEBUG:
      return "DEBUG";
    case Log.INFO:
      return "INFO";
    case Log.WARN:
      return "WARN";
    case Log.ERROR:
      return "ERROR";
    case Log.ASSERT:
      return "ASSERT";
    default:
      return "UNKNOWN";
  }
}
 
开发者ID:yshrsmz,项目名称:historian,代码行数:18,代码来源:Util.java

示例4: 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

示例5: 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

示例6: prefixForPriority

public static String prefixForPriority(int priority) {
    switch (priority) {
        case Log.VERBOSE:
            return "[VERBOSE] ";
        case Log.DEBUG:
            return "[DEBUG] ";
        case Log.INFO:
            return "[INFO] ";
        case Log.WARN:
            return "[WARN] ";
        case Log.ERROR:
            return "[ERROR] ";
        case Log.ASSERT:
            return "[ASSERT] ";
        default:
            return "[UNKNOWN(" + priority + ")] ";
    }
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:18,代码来源:LogMessageHelper.java

示例7: 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

示例8: getBackgroundColorForLogLevel

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);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:25,代码来源:LogLineAdapterUtil.java

示例9: displayLevel

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 "?";
  }
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:18,代码来源:LumberYard.java

示例10: longLog

private static void longLog(int mode, String tag, String message) {
    int maxLogSize = 1000;
    for (int i = 0; i <= message.length() / maxLogSize; i++) {
        int start = i * maxLogSize;
        int end = (i + 1) * maxLogSize;
        end = end > message.length() ? message.length() : end;

        if (mode == Log.DEBUG) {
            Log.d(TAG + tag, message.substring(start, end));
        } else if (mode == Log.ERROR) {
            Log.e(TAG + tag, message.substring(start, end));
        } else if (mode == Log.INFO) {
            Log.i(TAG + tag, message.substring(start, end));
        } else if (mode == Log.WARN) {
            Log.w(TAG + tag, message.substring(start, end));
        }
    }
}
 
开发者ID:qornanali,项目名称:MyBlogPost,代码行数:18,代码来源:Logger.java

示例11: log

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

@Override
protected void log(int priority, String tag, String message, Throwable t) {
    if(isLoggable(tag,priority)){

        if(priority == Log.ERROR && t!=null){
            //Send the log to your crashlatics framework
        }

        if(message.length() < MAX_LOG_LENGTH){
            if(priority == Log.ASSERT){
                Log.wtf(tag,message);
            }else {
                Log.println(priority,tag,message);
            }
            return;
        }
    }

    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);
            String part = message.substring(i, end);
            if (priority == Log.ASSERT) {
                Log.wtf(tag, part);
            } else {
                Log.println(priority, tag, part);
            }
            i = end;
        } while (i < newline);
    }

}
 
开发者ID:iamBedant,项目名称:InstantAppStarter,代码行数:34,代码来源:ReleaseTree.java

示例14: log

@Override
protected void log(int priority, String tag, String message, Throwable t) {
    Crashlytics.log(priority, message, tag);
    if (t != null) {
        Crashlytics.logException(t);
    }
    // If this is an error or a warning, log it as a exception so we see it in Crashlytics.
    if (priority >= Log.ERROR) {
        Crashlytics.logException(new Throwable(message));
    }
}
 
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:11,代码来源:IslamicLibraryApplication.java

示例15: 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";
    default:
      return String.valueOf(priority);
  }
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:14,代码来源:RecordingLogTree.java


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