[Gradle, JS] Remove copypaste for webpack and karma parse log

#KT-38109 fixed
#KT-38286 fixed
This commit is contained in:
Ilya Goncharov
2020-04-14 11:13:00 +03:00
parent db41c65240
commit 567ebfb180
@@ -444,34 +444,34 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) :
val (logLevel, message) = result.destructured val (logLevel, message) = result.destructured
val nonColoredMessage = message.clearAnsiColor() when (logLevel.toLowerCase()) {
WARN, ERROR -> {
when (logLevel) {
WARN -> {
processFailedBrowsers(text) processFailedBrowsers(text)
log.warn(nonColoredMessage)
} }
ERROR -> {
processFailedBrowsers(text)
log.error(nonColoredMessage)
}
INFO, LOG -> log.info(nonColoredMessage)
DEBUG -> log.debug(nonColoredMessage)
} }
processLogMessage(message, logLevel)
return return
} }
val nonColoredText = text.clearAnsiColor() type?.let { processLogMessage(text, it) }
}
if (type == "error") { private fun processLogMessage(
log.error(nonColoredText) message: String,
return type: String
} ) {
val nonColoredMessage = message.clearAnsiColor()
if (type == "warn") { when (type.toLowerCase()) {
log.warn(nonColoredText) WARN -> {
return log.warn(nonColoredMessage)
}
ERROR -> {
log.error(nonColoredMessage)
}
INFO, LOG -> log.info(nonColoredMessage)
DEBUG -> log.debug(nonColoredMessage)
} }
} }
@@ -553,11 +553,11 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) :
} }
} }
private const val ERROR = "ERROR" private const val ERROR = "error"
private const val WARN = "WARN" private const val WARN = "warn"
private const val INFO = "INFO" private const val INFO = "info"
private const val DEBUG = "DEBUG" private const val DEBUG = "debug"
private const val LOG = "LOG" private const val LOG = "log"
private val KARMA_MESSAGE = "^.*\\d{2} \\d{2} \\d{4,} \\d{2}:\\d{2}:\\d{2}.\\d{3}:(ERROR|WARN|INFO|DEBUG|LOG) \\[.*]: ([\\w\\W]*)\$" private val KARMA_MESSAGE = "^.*\\d{2} \\d{2} \\d{4,} \\d{2}:\\d{2}:\\d{2}.\\d{3}:(ERROR|WARN|INFO|DEBUG|LOG) \\[.*]: ([\\w\\W]*)\$"
.toRegex() .toRegex()