Implement the option of automatic tagging—similar to Timber 4 and earlier—in LogcatTree.
How it works: Instead of only accepting a String as the default tag in its constructor, LogcatTree now also accepts a () -> String. This tagResolver is invoked for each log if the explicit tag is null.
AutomaticTagResolver implements () -> String by crawling the stack trace for the appropriate class name. Its implementation is almost directly copied from the Timber 4 implementation. It includes a note in the KDocs that use in release builds is discouraged.
Happy to add tests and/or adjust the implementation/API if you accept the general premise of this PR.
Implement the option of automatic tagging—similar to Timber 4 and earlier—in
LogcatTree
.How it works: Instead of only accepting a
String
as the default tag in its constructor,LogcatTree
now also accepts a() -> String
. ThistagResolver
is invoked for each log if the explicit tag is null.AutomaticTagResolver
implements() -> String
by crawling the stack trace for the appropriate class name. Its implementation is almost directly copied from the Timber 4 implementation. It includes a note in the KDocs that use in release builds is discouraged.Happy to add tests and/or adjust the implementation/API if you accept the general premise of this PR.