Trying to write a wrapper to slf4j.
wrote the methods. 2 of them are:
def logWarn(message: => String, arg1: => AnyRef) = {
if (logger.isWarnEnabled) {
logger.warn(message, arg1)
}
}
def logWarn(message: => String, args: => Array[AnyRef]) = {
if (logger.isWarnEnabled) {
logger.warn(message, args)
}
}
This compiles nicely. Problem is trying to invoke:
logWarn("retried: {}. Error is: {}", Array[AnyRef](numOfRetries.toString(), e.toString()));
I would expect Scala to know I mean to call the second method above. for some reasons I get this error:
ambiguous reference to overloaded definition, both method logWarn in trait Slf4jLogger of type
(message: => String, args: => Array[AnyRef])Unit
and method logWarn in trait Slf4jLogger of type (message: => String, arg1: => AnyRef)Unit
match argument types (java.lang.String,Array[AnyRef])
What's going on?