Skip to content

Instantly share code, notes, and snippets.

@einarvalgeirsson
Created November 13, 2017 20:33
Show Gist options
  • Save einarvalgeirsson/45c3cb39b24e9816d6ee63adedad213e to your computer and use it in GitHub Desktop.
Save einarvalgeirsson/45c3cb39b24e9816d6ee63adedad213e to your computer and use it in GitHub Desktop.
Avoid having to declare TAG in all your class files
val Any.TAG: String
get() {
val klass = this.javaClass
return if(klass.isAnonymousClass) {
klass.enclosingClass.simpleName
} else {
klass.simpleName
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment