Package 

Interface Logcat


  • 
    public interface Logcat
    
                        

    The interface to work with logcat.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public enum Buffer
    • Method Summary

      Modifier and Type Method Description
      abstract Unit disableChatty() NOT WORKING ON ANDROID 8+The problem: Android OS has a special introduced mechanism to filter and collapse of some bunches of logs produced by applications.
      abstract Unit setBufferSize(LogcatBufferSize size) Set new logcat buffer size
      abstract Unit setDefaultBufferSize() Set default logcat buffer size
      abstract Unit clear(Logcat.Buffer buffer) Clear (flush) the selected buffers and exit.
      abstract List<String> readLogcatRows(String excludePattern, Boolean excludePatternIsIgnoreCase, String includePattern, Boolean includePatternIsIgnoreCase, Logcat.Buffer buffer, Integer rowLimit) Get logcat dump as list of strings
      abstract Boolean readLogcatRows(String excludePattern, Boolean excludePatternIsIgnoreCase, String includePattern, Boolean includePatternIsIgnoreCase, Logcat.Buffer buffer, Integer rowLimit, Function1<String, Boolean> readingBlock) Get logcat dump and analyze each row.
      • Methods inherited from class com.kaspersky.kaspresso.device.logcat.Logcat

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • disableChatty

         abstract Unit disableChatty()

        NOT WORKING ON ANDROID 8+

        The problem: Android OS has a special introduced mechanism to filter and collapse of some bunches of logs produced by applications. The name of the such mechanism is Chatty. Chatty turns on when an application writes a lot of logs. The goal of Logcat interface is to analyze all logs. But Chatty prevents achievement of the mentioned goal. That's why, there is this method to disable Chatty. Please, call the method in "before" section of a test.

      • clear

         abstract Unit clear(Logcat.Buffer buffer)

        Clear (flush) the selected buffers and exit. The default buffer set is main, system and crash.

        Parameters:
        buffer - one of available logcat buffers
      • readLogcatRows

         abstract List<String> readLogcatRows(String excludePattern, Boolean excludePatternIsIgnoreCase, String includePattern, Boolean includePatternIsIgnoreCase, Logcat.Buffer buffer, Integer rowLimit)

        Get logcat dump as list of strings

        Parameters:
        excludePattern - logcat will EXCLUDE rows that match the pattern
        excludePatternIsIgnoreCase - boolean is exclude pattern must ignore string case
        includePattern - logcat will contains ONLY rows that match the pattern
        includePatternIsIgnoreCase - boolean is include pattern must ignore string case
        buffer - one of available logcat buffers
        rowLimit - limiter of logcat output, starts FROM BEGINNING of logcat dump WITH EXTRA ROW of buffer beginning, if null return all rows
      • readLogcatRows

         abstract Boolean readLogcatRows(String excludePattern, Boolean excludePatternIsIgnoreCase, String includePattern, Boolean includePatternIsIgnoreCase, Logcat.Buffer buffer, Integer rowLimit, Function1<String, Boolean> readingBlock)

        Get logcat dump and analyze each row. Logcat reading stops if analyzerBlock returns false on some row

        Parameters:
        excludePattern - logcat will EXCLUDE rows that match the pattern
        excludePatternIsIgnoreCase - boolean is exclude pattern must ignore string case
        includePattern - logcat will contains ONLY rows that match the pattern
        includePatternIsIgnoreCase - boolean is include pattern must ignore string case
        buffer - one of available logcat buffers
        rowLimit - limiter of logcat output, starts FROM BEGINNING of logcat dump WITH EXTRA ROW of buffer beginning, if null return all rows
        readingBlock - lambda with String input and Boolean output.