From 156ddd3fae75d3752ae81444e9f78108635584d6 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Fri, 11 Oct 2024 14:24:25 +0100 Subject: [PATCH 1/2] Kotlin: Log our verbosity level This happens at `info` level, which is logged by default. --- .../src/main/kotlin/KotlinExtractorExtension.kt | 1 + java/kotlin-extractor/src/main/kotlin/utils/Logger.kt | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt b/java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt index 3850d690a61c..1fc8ee37fc03 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt @@ -140,6 +140,7 @@ class KotlinExtractorExtension( val logger = Logger(loggerBase, tw) logger.info("Extraction started") logger.flush() + logger.infoVerbosity() logger.info("Extraction for invocation TRAP file $invocationTrapFile") logger.flush() logger.info("Kotlin version ${KotlinCompilerVersion.getVersion()}") diff --git a/java/kotlin-extractor/src/main/kotlin/utils/Logger.kt b/java/kotlin-extractor/src/main/kotlin/utils/Logger.kt index 1eda875be2fc..dfbb5fdf8e29 100644 --- a/java/kotlin-extractor/src/main/kotlin/utils/Logger.kt +++ b/java/kotlin-extractor/src/main/kotlin/utils/Logger.kt @@ -244,6 +244,10 @@ open class LoggerBase(val logCounter: LogCounter) { } } + fun infoVerbosity(dtw: DiagnosticTrapWriter) { + info(dtw, "Kotlin extractor verbosity is " + verbosity.toString()) + } + fun warn(dtw: DiagnosticTrapWriter, msg: String, extraInfo: String?) { if (verbosity >= 2) { diagnostic(dtw, Severity.Warn, msg, extraInfo) @@ -301,6 +305,10 @@ open class Logger(val loggerBase: LoggerBase, val dtw: DiagnosticTrapWriter) { loggerBase.info(dtw, msg) } + fun infoVerbosity() { + loggerBase.infoVerbosity(dtw) + } + private fun warn(msg: String, extraInfo: String?) { loggerBase.warn(dtw, msg, extraInfo) } From 9f340279cbd52ce5998ff70b44d81138800d7a40 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Fri, 11 Oct 2024 15:10:19 +0100 Subject: [PATCH 2/2] Kotlin: Accept test changes --- .../ql/integration-tests/kotlin/all-platforms/logs/logs.expected | 1 + 1 file changed, 1 insertion(+) diff --git a/java/ql/integration-tests/kotlin/all-platforms/logs/logs.expected b/java/ql/integration-tests/kotlin/all-platforms/logs/logs.expected index 5fc4366688ea..b7f2d0a0b378 100644 --- a/java/ql/integration-tests/kotlin/all-platforms/logs/logs.expected +++ b/java/ql/integration-tests/kotlin/all-platforms/logs/logs.expected @@ -1,5 +1,6 @@ Log file 1 {"origin": "CodeQL Kotlin extractor", "kind": "INFO", "message": "Extraction started"} +{"origin": "CodeQL Kotlin extractor", "kind": "INFO", "message": "Kotlin extractor verbosity is 3"} {"origin": "CodeQL Kotlin extractor", "kind": "INFO", "message": "Extraction for invocation TRAP file "} {"origin": "CodeQL Kotlin extractor", "kind": "INFO", "message": "Kotlin version "} {"origin": "CodeQL Kotlin extractor", "kind": "INFO", "message": "Extracting file test.kt"}