Skip to content

Commit

Permalink
Merge pull request #17741 from github/igfoo/logverb
Browse files Browse the repository at this point in the history
Kotlin: Log our verbosity level
  • Loading branch information
igfoo authored Oct 15, 2024
2 parents 1626af0 + 9f34027 commit 24d98ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()}")
Expand Down
8 changes: 8 additions & 0 deletions java/kotlin-extractor/src/main/kotlin/utils/Logger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <FILENAME>"}
{"origin": "CodeQL Kotlin extractor", "kind": "INFO", "message": "Kotlin version <VERSION>"}
{"origin": "CodeQL Kotlin extractor", "kind": "INFO", "message": "Extracting file test.kt"}
Expand Down

0 comments on commit 24d98ee

Please sign in to comment.