Created
April 29, 2016 02:10
-
-
Save luksrn/f0afbc730571218e06fae78f740cf7bc to your computer and use it in GitHub Desktop.
GrapeLogger.groovy
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
@Grapes( | |
@Grab(group='log4j', module='log4j', version='1.2.16') | |
) | |
import org.apache.commons.logging.LogFactory; | |
import org.apache.commons.logging.Log; | |
trait Loggable { | |
private Log logger | |
Log getLog() { | |
if( !logger ) | |
logger = LogFactory.getLog( this.getClass() ) | |
logger | |
} | |
} | |
class Foo implements Loggable { | |
def foo() { | |
log.info( 'info foo' ) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment