waqas
05/30/2018, 9:53 AMfun trace(tag: String, msg: String, vararg params: Any?)
as an API in my SDK so that if somebody wants to have their custom logger they can give one and show/send logs to crashlytics etc. For lazy string concatenation I use varargs so that API devs can use String.format etc when they really need that log statement.
My question is how can i use nice $ interpolations within my sdk code but still get parameters out of that string without evaluating it?
One solution is change api to accept lambda instead of String msg like this fun debug(tag: String, msg: () -> Any)
, but that API doesn't look nice for java consumers. Also even for kotlin consumers String messaged wrapped in ()->Any feels awkward.
Crossposting from #android channel as this is not specific to android.