Logging for highlighting test commands

GitOrigin-RevId: cf3acbd65820257b30579013558128822f0a0b1f
This commit is contained in:
Alexey Kryuchkov
2024-06-27 00:31:20 +04:00
committed by intellij-monorepo-bot
parent 3c247f867f
commit 174e018654
2 changed files with 16 additions and 1 deletions

View File

@@ -313,7 +313,8 @@ internal class WaitForFinishedCodeAnalysisListener(private val project: Project)
}
private fun daemonStopped(fileEditors: Collection<FileEditor>, isCancelled: Boolean) {
ListenerState.LOG.info("daemon stopped with ${fileEditors.size} unfiltered editors")
val status = if(isCancelled) "cancelled" else "stopped"
ListenerState.LOG.info("daemon $status with ${fileEditors.size} unfiltered editors")
val worthy = fileEditors.getWorthy()
if (worthy.isEmpty()) return

View File

@@ -1,6 +1,7 @@
package com.jetbrains.performancePlugin.utils
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.fileEditor.FileEditor
import com.intellij.openapi.util.Ref
import com.intellij.util.messages.SimpleMessageBusConnection
@@ -11,6 +12,9 @@ import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit
internal object DaemonCodeAnalyzerListener {
val LOG = logger<DaemonCodeAnalyzerListener>()
/**
* Listen to the SimpleMessageBusConnection to receive notifications when the daemon finishes.
*
@@ -27,6 +31,7 @@ internal object DaemonCodeAnalyzerListener {
val result = DaemonCodeAnalyzerResult(connection, spanRef, timeoutInSeconds)
connection.subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, object : DaemonCodeAnalyzer.DaemonListener {
override fun daemonFinished(fileEditors: Collection<FileEditor>) {
printFinishedAnalyzers(fileEditors)
if (expectedOpenedFile == null) {
result.release()
}
@@ -37,6 +42,15 @@ internal object DaemonCodeAnalyzerListener {
})
return result
}
private fun printFinishedAnalyzers(fileEditors: Collection<FileEditor>) {
try {
fileEditors.forEach { LOG.info("daemonFinished for ${it.file.name}") }
} catch (throwable:Throwable) {
LOG.error("printFinishedAnalyzers failed ${throwable.message}")
}
}
}
internal class DaemonCodeAnalyzerResult(private val connection: SimpleMessageBusConnection,