Last active
January 7, 2020 09:26
-
-
Save adamw/b091f96ed8074011e120224e8dee1aec to your computer and use it in GitHub Desktop.
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
def timeRequest(request: HttpRequest): Try[RouteResult] => Unit = { | |
val start = System.currentTimeMillis() | |
{ | |
case Success(Complete(resp)) => | |
val d = System.currentTimeMillis() - start | |
logger.info(s"[${resp.status.intValue()}] ${request.method.name} " + | |
s"${request.uri} took: ${d}ms") | |
case Success(Rejected(_)) => | |
case Failure(_) => | |
} | |
} | |
val routes: Route = | |
aroundRequest(timeRequest) { | |
path("...") { | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment