You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FYI in case someone else also runs into this, when using Scala 3 and varargs with `:_*` (or just `*` using Scala 3 syntax) the code compiles with scala-logging 3.9.4 and 3.9.5, but doesn't actually pass the values to the underlying logger. You can check following script with scala-cli:
//> using dep "com.typesafe.scala-logging::scala-logging:3.9.4"
//> using dep "ch.qos.logback:logback-classic:1.5.1"
import com.typesafe.scalalogging.LazyLogging
object Test extends LazyLogging {
def log(): Unit = {
val args = Seq("1", "2")
logger.info("test {} {}", args:_*)
}
}
Test.log()
when running with --scala-version 2.13.12 it will print "test 1 2" and with --scala-version 3.3.1 just "test {} {}". With scala-logging 3.9.5 it won't compile on 2.13 at all
val args = Seq("1", "2")
logger.info("test {} {}", args:_*)
It is not currently supported in scala 3. #433 supports this by hardcoding it, but another way is to add a specific API that doesn't include formatArgs
when running with
--scala-version 2.13.12
it will print"test 1 2"
and with--scala-version 3.3.1
just"test {} {}"
. With scala-logging 3.9.5 it won't compile on 2.13 at allI think the issue for Scala 3 is in this part of the macro:
https://github.com/lightbend-labs/scala-logging/blob/main/src/main/scala-3/com/typesafe/scalalogging/LoggerMacro.scala#L279
Originally posted by @SakulK in #354 (comment)
The text was updated successfully, but these errors were encountered: