Skip to content

Commit a2af70e

Browse files
authored
SONARKT-674 Replace "TRACE" logging level with "DEBUG"
1 parent 7f7495f commit a2af70e

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

sonar-kotlin-api/src/main/java/org/sonarsource/kotlin/api/logging/LoggerExtensions.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,3 @@ fun Logger.info(provider: () -> String) {
2525
fun Logger.debug(provider: () -> String) {
2626
if (this.isDebugEnabled) this.debug(provider.invoke())
2727
}
28-
29-
fun Logger.trace(provider: () -> String) {
30-
if (this.isTraceEnabled) this.trace(provider.invoke())
31-
}

sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/plugin/KotlinSensor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import org.sonarsource.kotlin.api.checks.hasCacheEnabled
3333
import org.sonarsource.kotlin.api.common.KotlinLanguage
3434
import org.sonarsource.kotlin.api.common.SONAR_JAVA_BINARIES
3535
import org.sonarsource.kotlin.api.common.SONAR_JAVA_LIBRARIES
36-
import org.sonarsource.kotlin.api.logging.trace
36+
import org.sonarsource.kotlin.api.logging.debug
3737
import org.sonarsource.kotlin.api.sensors.AbstractKotlinSensor
3838
import org.sonarsource.kotlin.api.sensors.AbstractKotlinSensorExecuteContext
3939
import org.sonarsource.kotlin.plugin.caching.ContentHashCache
@@ -139,7 +139,7 @@ class KotlinSensor(
139139
try {
140140
nextCache.copyCPDTokensFromPrevious(inputFile)
141141
} catch (_: IllegalArgumentException) {
142-
LOG.trace { "Unable to save the CPD tokens of file $inputFile for the next analysis." }
142+
LOG.debug { "Unable to save the CPD tokens of file $inputFile for the next analysis." }
143143
}
144144
true
145145
} ?: false

sonar-kotlin-plugin/src/main/java/org/sonarsource/kotlin/plugin/caching/ContentHashCache.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import org.sonar.api.batch.sensor.SensorContext
2222
import org.sonar.api.batch.sensor.cache.ReadCache
2323
import org.sonar.api.batch.sensor.cache.WriteCache
2424
import org.sonarsource.kotlin.api.checks.hasCacheEnabled
25-
import org.sonarsource.kotlin.api.logging.trace
25+
import org.sonarsource.kotlin.api.logging.debug
2626
import java.security.MessageDigest
2727

2828
private val LOG = LoggerFactory.getLogger(ContentHashCache::class.java)
@@ -58,15 +58,15 @@ class ContentHashCache private constructor(private val readCache: ReadCache, pri
5858
if (cacheContentIsEqual) {
5959
try {
6060
writeCache.copyFromPrevious(key)
61-
LOG.trace { "Cache contained same hash for file ${inputFile.filename()}" }
61+
LOG.debug { "Cache contained same hash for file ${inputFile.filename()}" }
6262
} catch (_: IllegalArgumentException) {
6363
LOG.warn("Cannot copy key $key from cache as it has already been written")
6464
}
6565
return false
6666
}
6767
}
6868
write(key, getHash(inputFile))
69-
LOG.trace { "Cache contained a different hash for file ${inputFile.filename()}" }
69+
LOG.debug { "Cache contained a different hash for file ${inputFile.filename()}" }
7070
return true
7171
}
7272

@@ -86,4 +86,4 @@ class ContentHashCache private constructor(private val readCache: ReadCache, pri
8686

8787
private fun getHash(inputFile: InputFile) =
8888
inputFile.contents().byteInputStream().use { it.readAllBytes() }.let { messageDigest.digest(it) }
89-
}
89+
}

sonar-kotlin-plugin/src/test/java/org/sonarsource/kotlin/plugin/KotlinSensorTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ internal class KotlinSensorTest : AbstractSensorTest() {
447447

448448
assertAnalysisIsIncremental(files)
449449
// Check that the exception has been logged
450-
assertThat(logTester.logs(Level.TRACE)).contains("Unable to save the CPD tokens of file unchanged.kt for the next analysis.")
450+
assertThat(logTester.logs(Level.DEBUG)).contains("Unable to save the CPD tokens of file unchanged.kt for the next analysis.")
451451
}
452452

453453
@Test

0 commit comments

Comments
 (0)