Created
September 16, 2015 08:17
-
-
Save mykola-dev/77983977b4127ec417f3 to your computer and use it in GitHub Desktop.
gradle log with timestamps
This file contains hidden or 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
gradle.useLogger(new TimestampEventLogger()) | |
class TimestampEventLogger extends BuildAdapter implements TaskExecutionListener { | |
def timestamp = 0L | |
public void beforeExecute(Task task) { | |
print "> $task.project.name:$task.name " | |
timestamp = System.currentTimeMillis() | |
} | |
public void afterExecute(Task task, TaskState state) { | |
def elapsed=(System.currentTimeMillis()-timestamp)/1000F | |
println "[$elapsed]" | |
} | |
public void buildFinished(BuildResult result) { | |
println 'build completed' | |
if (result.failure != null) { | |
result.failure.printStackTrace() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment