Created
October 10, 2012 19:02
-
-
Save nraychaudhuri/3867692 to your computer and use it in GitHub Desktop.
Enable logging for Play test
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
import play.api._ | |
import play.api.test._ | |
import play.api.test.Helpers._ | |
trait Loggable { | |
protected def enableLog = { | |
Logger.configure( | |
Map("application.home" -> new java.io.File(".").getAbsolutePath), | |
Map.empty, | |
Mode.Dev) | |
} | |
protected def runningWithLog[T](fakeApp: FakeApplication)(block: => T): T = { | |
running(fakeApp){ | |
try { | |
enableLog | |
block | |
} finally { | |
Logger.shutdown() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment