ajalt / timberkt

Easy Android logging with Kotlin and Timber
Apache License 2.0
205 stars 12 forks source link

[Question] Why are the extension methods on Timber's Tree object? #1

Closed Plastix closed 8 years ago

Plastix commented 8 years ago

I noticed that the extension methods in timberkt are on Timber's Tree class: Timber.Tree.d(...) Why is this the case? Why aren't they on the Timber class directly? Because of this I have to import your Timber object instead of using the regular Timber class. Thanks!

NitroG42 commented 8 years ago

I think the answer is : In Kotlin, we can't add static extension for a class, so we can't add method for the original Timber class (using a lambda instead of a String).

Plastix commented 8 years ago

This makes a lot of sense. Thanks @NitroG42!