Skip to content

Instantly share code, notes, and snippets.

@gabfssilva
Created August 28, 2017 22:33
Show Gist options
  • Save gabfssilva/acb59b498213bd63a2af3b59716708cc to your computer and use it in GitHub Desktop.
Save gabfssilva/acb59b498213bd63a2af3b59716708cc to your computer and use it in GitHub Desktop.
akka http loggedRequest
def loggedRequest(magnet: LoggingMagnet[String ⇒ Unit]): Directive0 = extractRequestContext.flatMap { ctx ⇒
val timer = Timer.start
mapRouteResult {
case result: Complete =>
//extracting request and complete route result here
result
case result: Rejected =>
//extracting request and rejected route result here
result
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment