code: public boolean waitForLogMessage(String logMessage, int timeout){
  		StringBuilder stringBuilder = new StringBuilder();
  
  		long endTime = SystemClock.uptimeMillis() + timeout;
  		while (SystemClock.uptimeMillis() <= endTime) {
  
  			if(getLog(stringBuilder).lastIndexOf(logMessage) != -1){
  				return true;
  			}
  			sleeper.sleep();
  		}
  		return false;
  	}
docs: Waits for a log message to appear.
  Requires read logs permission (android.permission.READ_LOGS) in AndroidManifest.xml of the application under test.
  
  @param logMessage the log message to wait for
  @param timeout the amount of time in milliseconds to wait
  @return true if log message appears and false if it does not appear before the timeout