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

support sending the underlying vararg to branch trees #392

Closed kaushikgopal closed 4 years ago

kaushikgopal commented 4 years ago

This is a potential feature request

With a lot of third party (logging/monitoring/crash) services, there are times when it's useful to send metadata at a per log level (as against the global user level).

so basically instead of:

protected abstract fun log(priority: Int, tag: String?, message: String, t: Throwable?)

supply the args sent in as well

protected abstract fun log(priority: Int, tag: String?, message: String, t: Throwable?, vararg args: Any?)

This allows branch trees to potentially send the args separately to a service (potentially attaching it as more metadata).

Can add more context, if the use case doesn't make sense. I think it's similar to what was brought up here (I think).

kaushikgopal commented 4 years ago

The trouble with this proposal/discussion is that it does change the purpose/direction of vararg arg.

Currently, it serves as a convenience for string formatting (which was served well in Java land), but with Kotlin's powerful string interpolation, it feels like the vararg could be better leveraged by providing metadata around logs?

JakeWharton commented 4 years ago

Can you add your usecase to #184 in as much detail as you're able to share?

Kotlin inline functions and deferred lambdas and string templating is coming, but that's going to be totally separate from "context" arguments. Vararg is kinda terrible because you're allocating the array and filling its contents even when logging is disabled. And even when it's enabled, you immediately unpack the array. Bad all around. I don't want to re-use it for contexts/metadata.

JakeWharton commented 4 years ago

I'm getting back into Timber soon™. I know it's been kinda stuck for a while.

Lola150716 commented 4 years ago

Kanuengnit strange

On Sat, 23 May 2020, 03:57 Jake Wharton, notifications@github.com wrote:

Closed #392 https://github.com/JakeWharton/timber/issues/392.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JakeWharton/timber/issues/392#event-3366625978, or unsubscribe https://github.com/notifications/unsubscribe-auth/APACBR3LRLDOVTCWBDU6W4LRS43RPANCNFSM4NHG3R3Q .

sanginovs commented 4 years ago

@JakeWharton so how do you go about implementing this feature? what is the best way to achieve this?

hannesa2 commented 4 years ago

I'm getting back into Timber soon™.

ping

JakeWharton commented 4 years ago

No. Unless you'd like pay me, you don't control how I spend time.