Last active
August 29, 2015 14:10
-
-
Save oehme/136f24167311087f7cfa to your computer and use it in GitHub Desktop.
LogProcessor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Target(TYPE) | |
@Active(LogProcessor) | |
annotation Log { | |
} | |
class LogProcessor extends AbstractClassProcessor { | |
override doTransform(MutableClassDeclaration cls, extension TransformationContext context) { | |
cls.addField("log") [ | |
static = true | |
final = true | |
type = Logger.newTypeReference | |
initializer = ''' | |
«Logger».getLogger("«cls.qualifiedName»") | |
''' | |
primarySourceElement = cls | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment