Created
August 28, 2012 16:09
-
-
Save tednaleid/3499584 to your computer and use it in GitHub Desktop.
output every grails event with timing
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
diff --git a/scripts/_GrailsEvents.groovy b/scripts/_GrailsEvents.groovy | |
index bc0b479..bb8f13e 100644 | |
--- a/scripts/_GrailsEvents.groovy | |
+++ b/scripts/_GrailsEvents.groovy | |
@@ -49,13 +49,19 @@ binding.addBuildListener(eventListener) | |
// Set up the classpath for the event hooks. | |
classpath() | |
// Now load them. | |
eventListener.classLoader = new GroovyClassLoader(classLoader) | |
eventListener.initialize() | |
+long eventInitStart = new Date().time | |
+ | |
// Send a scripting event notification to any and all event hooks in plugins/user scripts | |
event = {String name, args -> | |
try { | |
+ grailsConsole.addStatus "#### (${new Date().time - eventInitStart}) $name $args" | |
+ grailsConsole.lastMessage = "" | |
eventListener.triggerEvent(name, * args) | |
} | |
catch(e) { |
Cool stuff. One nit - new Date().time == System.currentTimeMillis(), no need to instantiate and toss a Date
@burtbeckwith pull requests/forks accepted :)
That's ok, it's correct here: apache/grails-core@22dbc51 :)
Sweet! I've actually found this info really helpful/interesting, thanks for adding it into grails core.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ex output: