Skip to content

Commit b62d431

Browse files
author
Gopinath Langote
committed
iluwatar#348 - Data Tranfer Object : Use logger instead of print statements.
1 parent 8525bfd commit b62d431

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerClientApp.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
package com.iluwatar.datatransfer;
2626

27+
import org.slf4j.Logger;
28+
import org.slf4j.LoggerFactory;
29+
2730
import java.util.ArrayList;
2831
import java.util.List;
2932

@@ -38,6 +41,9 @@
3841
* And The CustomerDto ({@link CustomerDto} is data transfer object to share customer information.
3942
*/
4043
public class CustomerClientApp {
44+
45+
private static final Logger LOGGER = LoggerFactory.getLogger(CustomerClientApp.class);
46+
4147
/**
4248
* Method as act client and request to server for details.
4349
*
@@ -52,27 +58,27 @@ public static void main(String[] args) {
5258

5359
CustomerResource customerResource = new CustomerResource(customers);
5460

55-
System.out.println("All customers:-");
61+
LOGGER.info("All customers:-");
5662
List<CustomerDto> allCustomers = customerResource.getAllCustomers();
5763
printCustomerDetails(allCustomers);
5864

59-
System.out.println("----------------------------------------------------------");
65+
LOGGER.info("----------------------------------------------------------");
6066

61-
System.out.println("Deleting customer with id {1}");
67+
LOGGER.info("Deleting customer with id {1}");
6268
customerResource.delete(customerOne.getId());
6369
allCustomers = customerResource.getAllCustomers();
6470
printCustomerDetails(allCustomers);
6571

66-
System.out.println("----------------------------------------------------------");
72+
LOGGER.info("----------------------------------------------------------");
6773

68-
System.out.println("Adding customer three}");
74+
LOGGER.info("Adding customer three}");
6975
CustomerDto customerThree = new CustomerDto("3", "Lynda", "Blair");
7076
customerResource.save(customerThree);
7177
allCustomers = customerResource.getAllCustomers();
7278
printCustomerDetails(allCustomers);
7379
}
7480

7581
private static void printCustomerDetails(List<CustomerDto> allCustomers) {
76-
allCustomers.forEach(customer -> System.out.println(customer.getFirstName()));
82+
allCustomers.forEach(customer -> LOGGER.info(customer.getFirstName()));
7783
}
7884
}

0 commit comments

Comments
 (0)