SHARE
TWEET

Untitled

a guest Jun 18th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class LoggingSttpBackend[R[_], S](delegate: SttpBackend[R, S])
  2.   extends SttpBackend[R, S] with StrictLogging {
  3.    
  4.   override def send[T](request: Request[T, S]): R[Response[T]] = {
  5.     responseMonad.map(responseMonad.handleError(delegate.send(request)) {
  6.       case e: Exception =>
  7.         logger.error(
  8.           s"Exception when sending request: $request.\n" +
  9.             s"To reproduce, run: ${request.toCurl}",
  10.           e
  11.         )
  12.         responseMonad.error(e)
  13.     }) { response =>
  14.       logger.debug(
  15.         s"For request: $request got response: $response.\n" +
  16.           s"To reproduce, run: ${request.toCurl}"
  17.       )
  18.       response
  19.     }
  20.   }
  21.   override def close(): Unit = delegate.close()
  22.   override def responseMonad: MonadError[R] = delegate.responseMonad
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top