• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java LogCatMessage类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.android.ddmlib.logcat.LogCatMessage的典型用法代码示例。如果您正苦于以下问题:Java LogCatMessage类的具体用法?Java LogCatMessage怎么用?Java LogCatMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

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

示例1: startLogcatCrashViewer

点赞 3

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
public void startLogcatCrashViewer() {
	try {
		device.executeShellCommand("logcat -c", new GenericReceiver(), 10000, TimeUnit.MILLISECONDS);
	} catch (Exception e) {
		e.printStackTrace();
	} 
	LogCatReceiverTask lcrt = new LogCatReceiverTask(device);
	lcrt.addLogCatListener(new LogCatListener() {
		
		@Override
		public void log(List<LogCatMessage> msgList) {
			for(LogCatMessage lcmsg : msgList) {
				String msg = lcmsg.getMessage();
				
				if(/*msg.contains("Shutting down VM") ||*/
						msg.contains("VFY:") 
						)
					LoggerHelper.logEvent(MyLevel.VMCRASH, String.format("############### VM CRASHED ###############\n%s", lcmsg.toString()));
			}
		}
	});

	Thread logcatViewerThread = new Thread(lcrt);
	logcatViewerThread.start();
	
}
 

开发者ID:srasthofer,
项目名称:FuzzDroid,
代码行数:27,
代码来源:FrameworkEventManager.java

示例2: canAcceptLevel

点赞 3

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
/**
 * Check whether the  log level of the given message is acceptable
 */
private boolean canAcceptLevel(LogCatMessage line) {
    switch (line.getHeader().getLogLevel()) {
        case ASSERT:
            return aCheckBox.isSelected();
        case DEBUG:
            return dCheckBox.isSelected();
        case ERROR:
            return eCheckBox.isSelected();
        case INFO:
            return iCheckBox.isSelected();
        case VERBOSE:
            return vCheckBox.isSelected();
        case WARN:
            return wCheckBox.isSelected();
    }
    return true;
}
 

开发者ID:josesamuel,
项目名称:logviewer,
代码行数:21,
代码来源:LogView.java

示例3: parseLogLine

点赞 3

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
public static String parseLogLine(String logLine, String fileName, LogProcess logProcess) {
    LogCatMessage message = null;
    try {
        message = AndroidLogcatFormatter.tryParseMessage(logLine);
    } catch (Exception ex) {
    }
    if (message == null) {
        String updatedLogLine = mapLogLines(logLine, fileName, logProcess);
        if (updatedLogLine != null) {
            logLine = updatedLogLine;
        }
    } else {
        logProcess.setProcessID(message.getPid());
        String appName = message.getAppName();
        if (appName == null || appName.isEmpty() || appName.equals("?")) {
            appName = message.getTag();
            if (appName == null || appName.isEmpty() || appName.equals("?")) {
                appName = "TAG";
            }
        }
        logProcess.setProcessName(appName);
    }
    return logLine;
}
 

开发者ID:josesamuel,
项目名称:logviewer,
代码行数:25,
代码来源:LogLineUpdater.java

示例4: testLog

点赞 3

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
@Test
public void testLog() throws InterruptedException {
	AndroidDevice device = pollFirst();

	final LogCatFilter filter = new LogCatFilter("", "", "com.android", "",
			"", LogLevel.WARN);
	final LogCatListener lcl = new LogCatListener() {
		@Override
		public void log(List<LogCatMessage> msgList) {
			for (LogCatMessage msg : msgList) {
				if (filter.matches(msg)) {
					System.out.println(msg);
				}
			}
		}
	};

	device.addLogCatListener(lcl);

	Thread.sleep(50000000);
}
 

开发者ID:cosysoft,
项目名称:device,
代码行数:22,
代码来源:LogcatTest.java

示例5: testLogcat

点赞 3

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
@Test
public void testLogcat() throws InterruptedException {
  AndroidDevice device = getDevices().pollFirst();

  final LogCatFilter filter = new LogCatFilter("", "", "com.android", "",
      "", LogLevel.WARN);
  final LogCatListener lcl = new LogCatListener() {
    @Override
    public void log(List<LogCatMessage> msgList) {
      for (LogCatMessage msg : msgList) {
        if (filter.matches(msg)) {
          System.out.println(msg);
        }
      }
    }
  };

  device.addLogCatListener(lcl);

  Thread.sleep(60000);
}
 

开发者ID:cosysoft,
项目名称:device,
代码行数:22,
代码来源:Readme.java

示例6: canAcceptProcess

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
/**
 * Check whether the  process of the given message is acceptable
 */
private boolean canAcceptProcess(LogCatMessage line) {
    if (processFilter.isEmpty()) {
        return true;
    }
    boolean accept = true;
    if (logSourceManager.isDeviceSourceSelected()) {
        String appName = line.getAppName();
        if (appName != null) {
            accept = canAcceptProcessName(line.getAppName());
            if (!accept && appName.indexOf('.') == -1) {
                accept = canAcceptProcessName(line.getTag());
            }
        }
        if (accept && line.getPid() != 0) {
            accept = canAcceptPid(line.getPid());
        }
    } else {
        if (line.getTag() != null) {
            accept = canAcceptProcessName(line.getTag());
        }
        if (accept && line.getPid() != 0) {
            accept = canAcceptPid(line.getPid());
        }
    }
    return accept;
}
 

开发者ID:josesamuel,
项目名称:logviewer,
代码行数:30,
代码来源:LogView.java

示例7: processLine

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
@NotNull
@Override
public MyProcessingResult processLine(String line) {
    LogCatMessage message = null;
    String continuation = null;
    boolean validContinuation = false;
    try {
        message = AndroidLogcatFormatter.tryParseMessage(line);
        continuation = message == null ? AndroidLogcatFormatter.tryParseContinuation(line) : null;
        validContinuation = continuation != null && this.myPrevHeader != null;
    } catch (Exception ignored) {
    }

    if (message == null && !validContinuation) {
        return new MyProcessingResult(ProcessOutputTypes.STDOUT, canAcceptMessage(line), null);
    } else {
        if (message != null) {
            this.myPrevHeader = message.getHeader();
            this.myCustomApplicable = this.isMessageApplicable(message);
            this.myMessageSoFar.setLength(0);
        }

        boolean isApplicable = this.myCustomApplicable;
        if (!isApplicable) {
            this.myMessageSoFar.append(line);
            this.myMessageSoFar.append('\n');
        }

        Key key = AndroidLogcatUtils.getProcessOutputType(this.myPrevHeader.getLogLevel());
        MyProcessingResult result = new MyProcessingResult(key, isApplicable, this.myMessageSoFar.toString());
        if (isApplicable) {
            this.myMessageSoFar.setLength(0);
        }

        return result;
    }
}
 

开发者ID:josesamuel,
项目名称:logviewer,
代码行数:38,
代码来源:LogView.java

示例8: onLogLineReceived

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
@Override
public void onLogLineReceived(@NotNull LogCatMessage line) {
    try {
        LogProcess logProcess = new LogProcess();
        logProcess.setProcessID(line.getPid());
        String appName = line.getAppName();
        if (appName == null || appName.isEmpty() || appName.equals("?")) {
            appName = line.getTag();
            if (appName == null || appName.isEmpty() || appName.equals("?")) {
                appName = "TAG";
            }
        }
        logProcess.setProcessName(appName);
        String message = null;

        if (!line.getHeader().equals(myActiveHeader)) {
            myActiveHeader = line.getHeader();
            message = AndroidLogcatFormatter.formatMessageFull(myActiveHeader, line.getMessage());
        } else {
            message = AndroidLogcatFormatter.formatContinuation(line.getMessage());
        }

        if (message != null) {
            notifyLog(message, logProcess);
        }
    } catch (Exception ex) {
        logListener.debug(ex.getMessage());
    }
}
 

开发者ID:josesamuel,
项目名称:logviewer,
代码行数:30,
代码来源:DeviceLogDataProvider.java

示例9: testMatchingText

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
public void testMatchingText() {
    LogCatMessage msg = new LogCatMessage(LogLevel.VERBOSE,
            "", "", "", "", "",                        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            "message with word1 and word2");       //$NON-NLS-1$
    assertEquals(true, search("word1 with", msg)); //$NON-NLS-1$
    assertEquals(true, search("text:w.* ", msg));  //$NON-NLS-1$
    assertEquals(false, search("absent", msg));    //$NON-NLS-1$
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:9,
代码来源:LogCatFilterTest.java

示例10: testTagKeyword

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
public void testTagKeyword() {
    LogCatMessage msg = new LogCatMessage(LogLevel.VERBOSE,
            "", "", "", "tag", "",                     //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            "sample message");                     //$NON-NLS-1$
    assertEquals(false, search("t.*", msg));       //$NON-NLS-1$
    assertEquals(true, search("tag:t.*", msg));    //$NON-NLS-1$
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:8,
代码来源:LogCatFilterTest.java

示例11: testPidKeyword

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
public void testPidKeyword() {
    LogCatMessage msg = new LogCatMessage(LogLevel.VERBOSE,
            "123", "", "", "", "",                     //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            "sample message");                     //$NON-NLS-1$
    assertEquals(false, search("123", msg));       //$NON-NLS-1$
    assertEquals(true, search("pid:123", msg));    //$NON-NLS-1$
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:8,
代码来源:LogCatFilterTest.java

示例12: testAppNameKeyword

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
public void testAppNameKeyword() {
    LogCatMessage msg = new LogCatMessage(LogLevel.VERBOSE,
            "", "", "dalvik", "", "",                  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            "sample message");                     //$NON-NLS-1$
    assertEquals(false, search("dalv.*", msg));    //$NON-NLS-1$
    assertEquals(true, search("app:dal.*k", msg)); //$NON-NLS-1$
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:8,
代码来源:LogCatFilterTest.java

示例13: testCaseSensitivity

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
public void testCaseSensitivity() {
    LogCatMessage msg = new LogCatMessage(LogLevel.VERBOSE,
            "", "", "", "", "",
            "Sample message");

    // if regex has an upper case character, it should be
    // treated as a case sensitive search
    assertEquals(false, search("Message", msg));

    // if regex is all lower case, then it should be a
    // case insensitive search
    assertEquals(true, search("sample", msg));
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:14,
代码来源:LogCatFilterTest.java

示例14: search

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
/**
 * Helper method: search if the query string matches the message.
 * @param query words to search for
 * @param message text to search in
 * @return true if the encoded query is present in message
 */
private boolean search(String query, LogCatMessage message) {
    List<LogCatFilter> filters = LogCatFilter.fromString(query,
            LogLevel.VERBOSE);

    /* all filters have to match for the query to match */
    for (LogCatFilter f : filters) {
        if (!f.matches(message)) {
            return false;
        }
    }
    return true;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:19,
代码来源:LogCatFilterTest.java

示例15: canAccept

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
/**
 * Check whether the given line can be shown based on current filters
 */
private boolean canAccept(LogCatMessage line) {
    return canAcceptLevel(line) && canAcceptProcess(line) && canAcceptMessage(line);
}
 

开发者ID:josesamuel,
项目名称:logviewer,
代码行数:7,
代码来源:LogView.java

示例16: canAcceptMessage

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
/**
 * Check whether the message of the given message is acceptable
 */
private boolean canAcceptMessage(LogCatMessage line) {
    return (addFilters.isEmpty() || isInFilter(line, addFilters))
            && (removeFilters.isEmpty() || !isInFilter(line, removeFilters));
}
 

开发者ID:josesamuel,
项目名称:logviewer,
代码行数:8,
代码来源:LogView.java

示例17: isInFilter

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
/**
 * Check whether given message matches with any filter in the given set
 */
private boolean isInFilter(LogCatMessage line, Set<String> filter) {
    return isInFilter(line.getMessage(), filter) || isInFilter(line.getTag(), filter) || isInFilter(line.getAppName(), filter) || isInFilter("" + line.getPid(), filter);
}
 

开发者ID:josesamuel,
项目名称:logviewer,
代码行数:7,
代码来源:LogView.java

示例18: isMessageApplicable

点赞 2

import com.android.ddmlib.logcat.LogCatMessage; //导入依赖的package包/类
private boolean isMessageApplicable(LogCatMessage message) {
    return canAccept(message);
}
 

开发者ID:josesamuel,
项目名称:logviewer,
代码行数:4,
代码来源:LogView.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)