com.avito.android.runner.devices.internal.EmulatorsLogsReporterImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of impl Show documentation
Show all versions of impl Show documentation
Collection of infrastructure libraries and gradle plugins of Avito Android project
package com.avito.android.runner.devices.internal
import com.avito.k8s.model.KubePod
import com.avito.runner.service.worker.device.Serial
import java.io.File
internal class EmulatorsLogsReporterImpl(
private val outputFolder: File,
private val logcatDir: File,
private val logcatTags: Collection
) : EmulatorsLogsReporter {
override fun reportEmulatorLogs(pod: KubePod, emulatorName: Serial, log: String) {
val logFile = getLogFile(emulatorName.value)
logFile.parentFile?.mkdirs()
logFile.appendText("--- Logs of emulator: $pod ---\n")
logFile.appendText("$log\n")
}
override fun redirectLogcat(emulatorName: Serial, device: Device) {
val logcatFile = getFile(
dir = logcatDir,
emulatorName = emulatorName.value
)
device.redirectLogcatToFile(
file = logcatFile,
tags = logcatTags
)
}
override fun getLogFile(podIp: String): File {
return File(File(outputFolder, DEVICES_LOGS), "$podIp.txt")
}
private fun getFile(
dir: File,
emulatorName: String
) = File(dir, "$emulatorName.txt").apply { parentFile?.mkdirs() }
}
private const val DEVICES_LOGS = "devices"
© 2015 - 2024 Weber Informatics LLC | Privacy Policy