mirror of
https://github.com/ARM-software/devlib.git
synced 2025-03-03 16:57:51 +00:00
Merge pull request #176 from bjackman/logcat-docs
utils/anroid: Documentation for LogcatMonitor
This commit is contained in:
commit
e7a319b0a7
@ -537,6 +537,16 @@ def _check_env():
|
|||||||
aapt = _env.aapt
|
aapt = _env.aapt
|
||||||
|
|
||||||
class LogcatMonitor(threading.Thread):
|
class LogcatMonitor(threading.Thread):
|
||||||
|
"""
|
||||||
|
Helper class for monitoring Anroid's logcat
|
||||||
|
|
||||||
|
:param target: Android target to monitor
|
||||||
|
:type target: :class:`AndroidTarget`
|
||||||
|
|
||||||
|
device. Logcat entries that don't match any will not be
|
||||||
|
seen. If omitted, all entries will be sent to host.
|
||||||
|
:type regexps: list(str)
|
||||||
|
"""
|
||||||
|
|
||||||
FLUSH_SIZE = 1000
|
FLUSH_SIZE = 1000
|
||||||
|
|
||||||
@ -561,6 +571,12 @@ class LogcatMonitor(threading.Thread):
|
|||||||
self._regexps = regexps
|
self._regexps = regexps
|
||||||
|
|
||||||
def start(self, outfile=None):
|
def start(self, outfile=None):
|
||||||
|
"""
|
||||||
|
Start logcat and begin monitoring
|
||||||
|
|
||||||
|
:param outfile: Optional path to file to store all logcat entries
|
||||||
|
:type outfile: str
|
||||||
|
"""
|
||||||
if outfile:
|
if outfile:
|
||||||
self._logfile = outfile
|
self._logfile = outfile
|
||||||
else:
|
else:
|
||||||
@ -667,6 +683,15 @@ class LogcatMonitor(threading.Thread):
|
|||||||
"""
|
"""
|
||||||
Search a line that matches a regexp in the logcat log
|
Search a line that matches a regexp in the logcat log
|
||||||
Wait for it to appear if it's not found
|
Wait for it to appear if it's not found
|
||||||
|
|
||||||
|
:param regexp: regexp to search
|
||||||
|
:type regexp: str
|
||||||
|
|
||||||
|
:param timeout: Timeout in seconds, before rasing RuntimeError.
|
||||||
|
``None`` means wait indefinitely
|
||||||
|
:type timeout: number
|
||||||
|
|
||||||
|
:returns: List of matched strings
|
||||||
"""
|
"""
|
||||||
res = self.search(regexp)
|
res = self.search(regexp)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user