0

I am using akka-http + the directives logRequest + logResult

I have something along those lines

def entryPoint() = {
    val sid = UUID.randomUUID().toString
    logRequest( s" request[$sid]") {
      logResult(s"response[$sid]") {
          val sid2 = UUID.randomUUID().toString
          println(s"sid2 : $sid2")
          complete("Ok")
      }
    }
}

A 1st request prints sid and sid2 :

sid  = 87c7db3a-96bc-456d-a747-4a0388eebf65 
sid2 = 0eea70d7-9464-4bef-b62b-fc503de5cc60

A 2nd request prints the same sid, but a different sid2

sid  = 87c7db3a-96bc-456d-a747-4a0388eebf65
sid2 = 7355eeb0-f324-44a4-a61a-e629ba1a224f

Is the marker of logRequest evaluated once and reuse ? If this is the case, any hint on how to use string interpolation in the marker?

Thanks

ccheneson
  • 49,072
  • 8
  • 63
  • 68

0 Answers0