24
24
25
25
package com .iluwatar .datatransfer ;
26
26
27
+ import org .slf4j .Logger ;
28
+ import org .slf4j .LoggerFactory ;
29
+
27
30
import java .util .ArrayList ;
28
31
import java .util .List ;
29
32
38
41
* And The CustomerDto ({@link CustomerDto} is data transfer object to share customer information.
39
42
*/
40
43
public class CustomerClientApp {
44
+
45
+ private static final Logger LOGGER = LoggerFactory .getLogger (CustomerClientApp .class );
46
+
41
47
/**
42
48
* Method as act client and request to server for details.
43
49
*
@@ -52,27 +58,27 @@ public static void main(String[] args) {
52
58
53
59
CustomerResource customerResource = new CustomerResource (customers );
54
60
55
- System . out . println ("All customers:-" );
61
+ LOGGER . info ("All customers:-" );
56
62
List <CustomerDto > allCustomers = customerResource .getAllCustomers ();
57
63
printCustomerDetails (allCustomers );
58
64
59
- System . out . println ("----------------------------------------------------------" );
65
+ LOGGER . info ("----------------------------------------------------------" );
60
66
61
- System . out . println ("Deleting customer with id {1}" );
67
+ LOGGER . info ("Deleting customer with id {1}" );
62
68
customerResource .delete (customerOne .getId ());
63
69
allCustomers = customerResource .getAllCustomers ();
64
70
printCustomerDetails (allCustomers );
65
71
66
- System . out . println ("----------------------------------------------------------" );
72
+ LOGGER . info ("----------------------------------------------------------" );
67
73
68
- System . out . println ("Adding customer three}" );
74
+ LOGGER . info ("Adding customer three}" );
69
75
CustomerDto customerThree = new CustomerDto ("3" , "Lynda" , "Blair" );
70
76
customerResource .save (customerThree );
71
77
allCustomers = customerResource .getAllCustomers ();
72
78
printCustomerDetails (allCustomers );
73
79
}
74
80
75
81
private static void printCustomerDetails (List <CustomerDto > allCustomers ) {
76
- allCustomers .forEach (customer -> System . out . println (customer .getFirstName ()));
82
+ allCustomers .forEach (customer -> LOGGER . info (customer .getFirstName ()));
77
83
}
78
84
}
0 commit comments