0

I have a need at the app level to capture specific (2) logs. In the case below, the first regular expression is the only one that gets captured. I've confirmed by reversing the order of the regex's.

val regex = "*Filesize is larger than usual:*|*Data is synchronizing,*"
val command = "logcat -d --regex='$regex'"
val process = Runtime.getRuntime().exec(command)

I've been made aware that using the | operator isn't possible in this case (or is it?). Is there any other feasible/optimal path?

Full code

val regex = "*Filesize is larger than usual:*|*Data is synchronizing,*"
val command = "logcat -d --regex='$regex'"
val process = Runtime.getRuntime().exec(command)
val process = Runtime.getRuntime().exec(command)
process.inputStream.bufferedReader().useLines { lines ->
   lines.forEach { output ->

   }
}

user3050491
  • 95
  • 4
  • 12

0 Answers0