JakeWharton / timber

A logger with a small, extensible API which provides utility on top of Android's normal Log class.
https://jakewharton.github.io/timber/docs/5.x/
Apache License 2.0
10.41k stars 959 forks source link

Lint fix for "Using 'Log' instead of 'Timber...' is incorrectly applied #380

Open arriolac opened 4 years ago

arriolac commented 4 years ago

The lint checks that are applied whenever you use Log instead of Timber suggests that you should use Timber instead.

e.g.

Log.e("MyActivity", "Logging an error")

image

However, when you apply the suggested fix (1st or 2nd option in the screenshot), you get:

Log.Timber.e("Logging an error")

Update: This is only an issue in Kotlin.

TobiasReich commented 4 years ago

I'm still having the same issue. Any ETA for that?

jknair0 commented 4 years ago

https://github.com/JakeWharton/timber/blob/4fd8e2a09c81931e9c9b004f45aea2937835278c/timber-lint/src/main/java/timber/lint/WrongTimberUsageDetector.java#L665

In this statement, for the java source quick fix JavaUCallExpression.asSourceString returns android.util.Log.<methodName>(<args>) as String where as for the kotlin source quick fix KotlinUFunctionCallExpression.asSourceString returns only <methodName>(<args>) as String. Thus the issue.

vostrnad commented 3 years ago

Hi, I see the linked pull request is still open, but there don't seem to be any issues with it. Can we have it merged?