如何使用Android的亚行logcat排除按标记名称的某些消息? [英] How to exclude certain messages by TAG name using Android adb logcat?

查看:492
本文介绍了如何使用Android的亚行logcat排除按标记名称的某些消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

允许的logcat过滤日志,但它的工作方式是:你可以定义过滤器和logcat中只显示匹配过滤器的消息。但是,有没有一种方法来显示所有的日志,除非过滤器定义的一些标签?

Logcat allows filtering logs but it works like that: You define filters and logcat only displays messages which matches filters. But is there a way to display all logs EXCEPT some TAGs defined by filters?

推荐答案

如果您使用的是亚行logcat 您可以通过grep的管道,并用它的反向匹配: 从 grep的手册页

If you are using adb logcat you could pipe it through grep and use it's inverted matching: From the grep manpage:

V,--invert匹配           反转匹配的意识,选择不匹配的行。

v, --invert-match Invert the sense of matching, to select non-matching lines.

例如:

$adb logcat | grep --invert-match 'notshownmatchpattern' 

您可以通过使用经常EX pressions 的扩展这一点。

You can extend this by using regular expressions.

下面是这样一个前pression一个例子:

Here is an example of such an expression:

"/^(?:emails|tags|addresses)"

这人会检查任何一个给定的发生中,grep就那么就不一一列举了。

This one would check for either of the given to occur, grep would then not list them.

这篇关于如何使用Android的亚行logcat排除按标记名称的某些消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆