Skip to content

Instantly share code, notes, and snippets.

@amanjeetsingh150
Last active April 21, 2022 13:40
Show Gist options
  • Save amanjeetsingh150/e67d7ef4c8e12eee538cbf426fa919bd to your computer and use it in GitHub Desktop.
Save amanjeetsingh150/e67d7ef4c8e12eee538cbf426fa919bd to your computer and use it in GitHub Desktop.
Dumping logs via dadb
fun pullLogs(): File {
val logFilePath = "/data/local/tmp/logs/<file_name_here>.txt"
// 1
dadb.shell("logcat -v time -f $logFilePath -d")
// 2
val outputFile = File.createTempFile(outputFileName, ".txt")
val bufferedSink = outputFile.sink().buffer()
dadb.pull(bufferedSink, logFilePath)
return outputFile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment