10
10
import com .authenteq .util .NetworkUtils ;
11
11
import okhttp3 .RequestBody ;
12
12
import okhttp3 .Response ;
13
+ import org .slf4j .Logger ;
14
+ import org .slf4j .LoggerFactory ;
13
15
14
16
import java .io .IOException ;
15
- import java .util .logging .Logger ;
16
17
17
18
/**
18
19
* The Class TransactionsApi.
19
20
*/
20
21
public class TransactionsApi extends AbstractApi {
21
22
22
- private static final Logger LOGGER = Logger .getLogger (TransactionsApi .class . getName () );
23
+ private static final Logger log = LoggerFactory .getLogger ( TransactionsApi .class );
23
24
24
25
/**
25
26
* Send transaction.
@@ -30,7 +31,7 @@ public class TransactionsApi extends AbstractApi {
30
31
* the callback
31
32
*/
32
33
public static void sendTransaction (Transaction transaction , final GenericCallback callback ) {
33
- LOGGER . info ( "sendTransaction Call :" + transaction );
34
+ log . debug ( "sendTransaction Call :" + transaction );
34
35
RequestBody body = RequestBody .create (JSON , transaction .toString ());
35
36
NetworkUtils .sendPostRequest (BigChainDBGlobals .getBaseUrl () + BigchainDbApi .TRANSACTIONS , body , callback );
36
37
}
@@ -44,9 +45,10 @@ public static void sendTransaction(Transaction transaction, final GenericCallbac
44
45
* Signals that an I/O exception has occurred.
45
46
*/
46
47
public static void sendTransaction (Transaction transaction ) throws IOException {
47
- LOGGER . info ( "sendTransaction Call :" + transaction );
48
+ log . debug ( "sendTransaction Call :" + transaction );
48
49
RequestBody body = RequestBody .create (JSON , JsonUtils .toJson (transaction ));
49
50
Response response = NetworkUtils .sendPostRequest (BigChainDBGlobals .getBaseUrl () + BigchainDbApi .TRANSACTIONS , body );
51
+ response .close ();
50
52
}
51
53
52
54
/**
@@ -59,7 +61,7 @@ public static void sendTransaction(Transaction transaction) throws IOException {
59
61
* Signals that an I/O exception has occurred.
60
62
*/
61
63
public static Transaction getTransactionById (String id ) throws IOException {
62
- LOGGER . info ( "getTransactionById Call :" + id );
64
+ log . debug ( "getTransactionById Call :" + id );
63
65
Response response = NetworkUtils .sendGetRequest (BigChainDBGlobals .getBaseUrl () + BigchainDbApi .TRANSACTIONS + "/" + id );
64
66
String body = response .body ().string ();
65
67
response .close ();
@@ -79,7 +81,7 @@ public static Transaction getTransactionById(String id) throws IOException {
79
81
*/
80
82
public static Transactions getTransactionsByAssetId (String assetId , Operations operation )
81
83
throws IOException {
82
- LOGGER . info ( "getTransactionsByAssetId Call :" + assetId + " operation " + operation );
84
+ log . debug ( "getTransactionsByAssetId Call :" + assetId + " operation " + operation );
83
85
Response response = NetworkUtils .sendGetRequest (
84
86
BigChainDBGlobals .getBaseUrl () + BigchainDbApi .TRANSACTIONS + "?asset_id=" + assetId + "&operation=" + operation );
85
87
String body = response .body ().string ();
0 commit comments