Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8-beta-1
-
None
-
all
-
Patch
Description
The @Log family of annotations adds explicit support to Groovy for java.util.Logging, Commons Loggins, slf4j, and log4j. It was written and tested against the latest versions of these libraries.
In order to "future proof" the feature, we need to allow other frameworks to participate in the @Log annotations as well.
The attached patch allows users to easily write their own logging extensions. The 4 frameworks supported today use this exact mechanism to to their own work.
The difference between logging frameworks is hidden behind a strategy pattern called:
org.codehaus.groovy.transform.LogASTTransformation.LoggingStrategy
To define your own @Log style logger support, your @LogX annotation must have the following attribute:
Class<? extends LoggingStrategy> loggingStrategy() default MyLoggingStrategy.class;
And MyLoggingStrategy must be available at compile time. This class just needs to implement the interface correctly.
The complete patch is attached.