Last active
April 21, 2022 13:40
-
-
Save amanjeetsingh150/e67d7ef4c8e12eee538cbf426fa919bd to your computer and use it in GitHub Desktop.
Dumping logs via dadb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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