Index: build/android/pylib/device/logcat_monitor.py |
diff --git a/build/android/pylib/device/logcat_monitor.py b/build/android/pylib/device/logcat_monitor.py |
index 7ede49c53b811f41f381389e26c0798e066d0111..1d4cc24fa955467c8be13d82e95e5dff72ff4251 100644 |
--- a/build/android/pylib/device/logcat_monitor.py |
+++ b/build/android/pylib/device/logcat_monitor.py |
@@ -22,18 +22,20 @@ class LogcatMonitor(object): |
# Format: <DATE> <TIME> <PID> <TID> <LEVEL> <COMPONENT>: <MESSAGE> |
_THREADTIME_RE_FORMAT = r'\S* +\S* +(%s) +(%s) +(%s) +(%s): +(%s)$' |
- def __init__(self, adb, clear=True): |
+ def __init__(self, adb, clear=True, filter_specs=None): |
"""Create a LogcatMonitor instance. |
Args: |
adb: An instance of adb_wrapper.AdbWrapper. |
clear: If True, clear the logcat when monitoring starts. |
+ filter_specs: An optional list of '<tag>[:priority]' strings. |
""" |
if isinstance(adb, adb_wrapper.AdbWrapper): |
self._adb = adb |
else: |
raise ValueError('Unsupported type passed for argument "device"') |
self._clear = clear |
+ self._filter_specs = filter_specs |
self._logcat_out = None |
self._logcat_out_file = None |
self._logcat_proc = None |
@@ -76,7 +78,7 @@ class LogcatMonitor(object): |
# returned. |
# - failure_regex matches a line, in which case None is returned |
# - the timeout is hit, in which case a CommandTimeoutError is raised. |
- for l in self._adb.Logcat(): |
+ for l in self._adb.Logcat(filter_specs=self._filter_specs): |
m = success_regex.search(l) |
if m: |
return m |