[uast-inspection] IDEA-333003 support fluent api for slf4j

- now `addArgument` is taken into account and complex cases are skipped

GitOrigin-RevId: acbdd50da7199f24938f76d3a84d0d17857b261e
This commit is contained in:
Mikhail Pyltsin
2023-09-29 12:08:05 +02:00
committed by intellij-monorepo-bot
parent 2109003398
commit 46d30a46d9
5 changed files with 66 additions and 4 deletions

View File

@@ -544,7 +544,19 @@ class KotlinLoggingPlaceholderCountMatchesArgumentCountInspectionTest {
LoggerFactory.getLogger().atError().log("{}", RuntimeException("test"))
LoggerFactory.getLogger().atError().log("{} {}", 1, RuntimeException("test"))
LoggerFactory.getLogger().atError().log( "<warning descr="More arguments provided (2) than placeholders specified (1)">{}</warning>" , 1, RuntimeException("test"))
builder.log("<warning descr="Fewer arguments provided (1) than placeholders specified (2)">{} {}</warning>", 1)
logger2.atError().log("<warning descr="Fewer arguments provided (1) than placeholders specified (2)">{} {}</warning>", 1)
val loggingEventBuilder = logger2.atError()
loggingEventBuilder
.log("{} {}", 2) //skip, because it can be complex cases
logger2.atError()
.log("<warning descr="Fewer arguments provided (1) than placeholders specified (2)">{} {}</warning>", 2) //warn
logger2.atError()
.addArgument("s")
.addKeyValue("1", "1")
.log("{} {}", 2)
}
private val logger2 = LoggerFactory.getLogger()