Skip to content

Commit

Permalink
Add debug logger for out/in params
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownNPC committed Aug 21, 2019
1 parent a7d2e9c commit 3ef5e5a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
@@ -1,17 +1,21 @@
package com.github.unknownnpc.psw.api.executor

import com.typesafe.scalalogging.StrictLogging
import org.apache.http.client.methods.HttpUriRequest
import org.apache.http.impl.client.CloseableHttpClient
import org.apache.http.util.EntityUtils


trait RestHttpExecutor[REQ <: HttpUriRequest] extends Executor[REQ, String] {
trait RestHttpExecutor[REQ <: HttpUriRequest] extends Executor[REQ, String] with StrictLogging {

def httpClient: CloseableHttpClient

override def execute(req: REQ): String = {
logger.debug(s"Sending next request: [$req]")
val httpResponse = httpClient.execute(req)
EntityUtils.toString(httpResponse.getEntity)
val rawResponse = EntityUtils.toString(httpResponse.getEntity)
logger.debug(s"Retrieved next response: [$rawResponse]")
rawResponse
}

}
Expand Up @@ -89,4 +89,6 @@ object P24API {

def getInstance(merchId: java.lang.Long, merchPass: String) = apply(merchId, merchPass)

def getInstance(merchId: java.lang.Long, merchPass: String, httpClient: CloseableHttpClient) = apply(merchId, merchPass, httpClient)

}
Expand Up @@ -75,4 +75,6 @@ object QiwiAPI {

def getInstance(token: String) = apply(token)

def getInstance(token: String, httpClient: CloseableHttpClient) = apply(token, httpClient)

}
Expand Up @@ -94,4 +94,7 @@ object WebMoneyAPI {
def getInstance(wmid: String, password: String, kwmBytes: Array[Byte]) =
apply(wmid, password, kwmBytes)

def getInstance(wmid: String, password: String, kwmBytes: Array[Byte], httpClient: CloseableHttpClient) =
apply(wmid, password, kwmBytes, httpClient)

}

0 comments on commit 3ef5e5a

Please sign in to comment.