is there difference any performance between declar...
# announcements
h
is there difference any performance between declaring the
logger
in
companion object
or just declaring it outside the class like this
Copy code
private val logger = LoggerFactory.getLogger()
class SomeKotlinClass{
	//use logger here
}
? which one is for best practice?
l
Personally, I never try to analyze these kinds of functions performance-wise. It will never make that big of a difference
s
There is no real performance difference.
However, if you want your code more testable, I’d create a logger interface and use your favorite dependency injection method to provide an actual implementation.