2424
2525package com .iluwatar .datatransfer ;
2626
27+ import org .slf4j .Logger ;
28+ import org .slf4j .LoggerFactory ;
29+
2730import java .util .ArrayList ;
2831import java .util .List ;
2932
3841 * And The CustomerDto ({@link CustomerDto} is data transfer object to share customer information.
3942 */
4043public 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