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


Java LogLevel.ASSERT属性代码示例

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


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

示例1: processLogLines

/**
 * Parse a list of strings into {@link LogCatMessage} objects. This method
 * maintains state from previous calls regarding the last seen header of
 * logcat messages.
 * @param lines list of raw strings obtained from logcat -v long
 * @param device device from which these log messages have been received
 * @return list of LogMessage objects parsed from the input
 */
@NonNull
public List<LogCatMessage> processLogLines(String[] lines, IDevice device) {
    List<LogCatMessage> messages = new ArrayList<LogCatMessage>(lines.length);

    for (String line : lines) {
        if (line.isEmpty()) {
            continue;
        }

        Matcher matcher = sLogHeaderPattern.matcher(line);
        if (matcher.matches()) {
            mCurTime = matcher.group(1);
            mCurPid = matcher.group(2);
            mCurTid = matcher.group(3);
            mCurLogLevel = LogLevel.getByLetterString(matcher.group(4));
            mCurTag = matcher.group(5).trim();

            /* LogLevel doesn't support messages with severity "F". Log.wtf() is supposed
             * to generate "A", but generates "F". */
            if (mCurLogLevel == null && matcher.group(4).equals("F")) {
                mCurLogLevel = LogLevel.ASSERT;
            }
        } else {
            String pkgName = ""; //$NON-NLS-1$
            Integer pid = Ints.tryParse(mCurPid);
            if (pid != null && device != null) {
                pkgName = device.getClientName(pid);
            }
            LogCatMessage m = new LogCatMessage(mCurLogLevel, mCurPid, mCurTid,
                    pkgName, mCurTag, mCurTime, line);
            messages.add(m);
        }
    }

    return messages;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:LogCatMessageParser.java

示例2: processLogLines

/**
 * Parse a list of strings into {@link LogCatMessage} objects. This method
 * maintains state from previous calls regarding the last seen header of
 * logcat messages.
 * @param lines list of raw strings obtained from logcat -v long
 * @param pidToNameMapper mapper to obtain the app name given a pid
 * @return list of LogMessage objects parsed from the input
 */
public List<LogCatMessage> processLogLines(String[] lines,
        LogCatPidToNameMapper pidToNameMapper) {
    List<LogCatMessage> messages = new ArrayList<LogCatMessage>(lines.length);

    for (String line : lines) {
        if (line.length() == 0) {
            continue;
        }

        Matcher matcher = sLogHeaderPattern.matcher(line);
        if (matcher.matches()) {
            mCurTime = matcher.group(1);
            mCurPid = matcher.group(2);
            mCurTid = matcher.group(3);
            mCurLogLevel = LogLevel.getByLetterString(matcher.group(4));
            mCurTag = matcher.group(5).trim();

            /* LogLevel doesn't support messages with severity "F". Log.wtf() is supposed
             * to generate "A", but generates "F". */
            if (mCurLogLevel == null && matcher.group(4).equals("F")) {
                mCurLogLevel = LogLevel.ASSERT;
            }
        } else {
            LogCatMessage m = new LogCatMessage(mCurLogLevel, mCurPid, mCurTid,
                    pidToNameMapper.getName(mCurPid),
                    mCurTag, mCurTime, line);
            messages.add(m);
        }
    }

    return messages;
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:40,代码来源:LogCatMessageParser.java


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