From 186022e89cc3fde4025b8d406ed61fb77da37203 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Mon, 9 Sep 2024 17:34:41 +0100 Subject: [PATCH] KE2: Emit truncated diagnostic info --- .../src/main/kotlin/KotlinExtractor.kt | 2 +- .../kotlin-extractor2/src/main/kotlin/utils/Logger.kt | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt b/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt index 6904867ec71..9be80725c76 100644 --- a/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt +++ b/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt @@ -141,9 +141,9 @@ OLD: KE1 val globalExtensionState = KotlinExtractorGlobalState() */ doAnalysis(compression, trapDir, srcDir, loggerBase, dtw, compilation, invocationExtractionProblems, kotlinArgs) + loggerBase.printLimitedDiagnosticCounts(dtw) /* OLD: KE1 - loggerBase.printLimitedDiagnosticCounts(tw) logPeakMemoryUsage(logger, "after extractor") */ logger.info("Extraction completed") diff --git a/java/kotlin-extractor2/src/main/kotlin/utils/Logger.kt b/java/kotlin-extractor2/src/main/kotlin/utils/Logger.kt index 2bc8bc076b8..6fd69207b27 100644 --- a/java/kotlin-extractor2/src/main/kotlin/utils/Logger.kt +++ b/java/kotlin-extractor2/src/main/kotlin/utils/Logger.kt @@ -278,22 +278,19 @@ class LoggerBase(val diagnosticCounter: DiagnosticCounter): BasicLogger { } } -/* -OLD: KE1 fun printLimitedDiagnosticCounts(dtw: DiagnosticTrapWriter) { - for ((caller, info) in diagnosticCounter.diagnosticInfo) { - val severity = info.first - val count = info.second + for ((caller, count) in diagnosticCounter.diagnosticInfo) { + val callDescription = caller.first + val severity = caller.second if (count >= diagnosticCounter.diagnosticLimit) { val message = "Total of $count diagnostics (reached limit of ${diagnosticCounter.diagnosticLimit}) from $caller." if (verbosity >= 1) { - emitDiagnostic(dtw, severity, "Limit", message, message, null, dtw.unknownLocation) + emitDiagnostic(dtw, null, severity, "Limit", message, message, null, dtw.unknownLocation) } } } } -*/ override fun flush() { logStream.flush()