Hi Bardur,
You can use an Intent for that. I answered something similar at SO
http://stackoverflow.com/questions/24724185/how-to-log-all-requests-with-unfiltered/24877695#24877695
The code:
object RequestLogging {
def apply[A, B](intent: Cycle.Intent[A, B]) =
Cycle.Intent[A, B] {
case req =>
val startTime = System.currentTimeMillis()
Cycle.Intent.complete(intent)(req) ~> new ResponseFunction[Any]() {
override def apply[C <: Any](resp: HttpResponse[C]) = {
val responseTime = System.currentTimeMillis() - startTime
println(s"${req.remoteAddr} ${new Date()}
${req.method} ${req.uri}
${resp.underlying.asInstanceOf[Response].getStatus} $responseTime")
resp
}
}
}
}
...
val plan = new unfiltered.filter.Plan {
def intent = RequestLogging {
case GET(Path("/record/1")) => ...
}
}
Best regards,
--Joaquín
> --
> You received this message because you are subscribed to the Google Groups
> "Unfiltered" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
unfiltered-sca...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.