com.android.ddmlib.logcat
Class LogCatFilter

java.lang.Object
  extended by com.android.ddmlib.logcat.LogCatFilter

public final class LogCatFilter
extends java.lang.Object

A Filter for logcat messages. A filter can be constructed to match different fields of a logcat message. It can then be queried to see if a message matches the filter's settings.


Constructor Summary
LogCatFilter(java.lang.String name, java.lang.String tag, java.lang.String text, java.lang.String pid, java.lang.String appName, Log.LogLevel logLevel)
          Construct a filter with the provided restrictions for the logcat message.
 
Method Summary
static java.util.List<LogCatFilter> fromString(java.lang.String query, Log.LogLevel minLevel)
          Construct a list of LogCatFilter objects by decoding the query.
 java.lang.String getAppName()
           
 Log.LogLevel getLogLevel()
           
 java.lang.String getName()
           
 java.lang.String getPid()
           
 java.lang.String getTag()
           
 java.lang.String getText()
           
 boolean matches(LogCatMessage m)
          Check whether a given message will make it through this filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogCatFilter

public LogCatFilter(@NonNull
                    java.lang.String name,
                    @NonNull
                    java.lang.String tag,
                    @NonNull
                    java.lang.String text,
                    @NonNull
                    java.lang.String pid,
                    @NonNull
                    java.lang.String appName,
                    @NonNull
                    Log.LogLevel logLevel)
Construct a filter with the provided restrictions for the logcat message. All the text fields accept Java regexes as input, but ignore invalid regexes.

Parameters:
name - name for the filter
tag - value for the logcat message's tag field.
text - value for the logcat message's text field.
pid - value for the logcat message's pid field.
appName - value for the logcat message's app name field.
logLevel - value for the logcat message's log level. Only messages of higher priority will be accepted by the filter.
Method Detail

fromString

public static java.util.List<LogCatFilter> fromString(java.lang.String query,
                                                      Log.LogLevel minLevel)
Construct a list of LogCatFilter objects by decoding the query.

Parameters:
query - encoded search string. The query is simply a list of words (can be regexes) a user would type in a search bar. These words are searched for in the text field of each collected logcat message. To search in a different field, the word could be prefixed with a keyword corresponding to the field name. Currently, the following keywords are supported: "pid:", "tag:" and "text:". Invalid regexes are ignored.
minLevel - minimum log level to match
Returns:
list of filter settings that fully match the given query

getName

@NonNull
public java.lang.String getName()

getTag

@NonNull
public java.lang.String getTag()

getText

@NonNull
public java.lang.String getText()

getPid

@NonNull
public java.lang.String getPid()

getAppName

@NonNull
public java.lang.String getAppName()

getLogLevel

@NonNull
public Log.LogLevel getLogLevel()

matches

public boolean matches(LogCatMessage m)
Check whether a given message will make it through this filter.

Parameters:
m - message to check
Returns:
true if the message matches the filter's conditions.