#502 Replaced usages of System.out with logger.
This commit is contained in:
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.privateclassdata;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* Immutable stew class, protected with Private Class Data pattern
|
||||
@ -29,6 +32,8 @@ package com.iluwatar.privateclassdata;
|
||||
*/
|
||||
public class ImmutableStew {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ImmutableStew.class);
|
||||
|
||||
private StewData data;
|
||||
|
||||
public ImmutableStew(int numPotatoes, int numCarrots, int numMeat, int numPeppers) {
|
||||
@ -39,8 +44,7 @@ public class ImmutableStew {
|
||||
* Mix the stew
|
||||
*/
|
||||
public void mix() {
|
||||
System.out.println(String.format(
|
||||
"Mixing the immutable stew we find: %d potatoes, %d carrots, %d meat and %d peppers",
|
||||
data.getNumPotatoes(), data.getNumCarrots(), data.getNumMeat(), data.getNumPeppers()));
|
||||
LOGGER.info("Mixing the immutable stew we find: {} potatoes, {} carrots, {} meat and {} peppers",
|
||||
data.getNumPotatoes(), data.getNumCarrots(), data.getNumMeat(), data.getNumPeppers());
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.privateclassdata;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* Mutable stew class
|
||||
@ -29,6 +32,8 @@ package com.iluwatar.privateclassdata;
|
||||
*/
|
||||
public class Stew {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Stew.class);
|
||||
|
||||
private int numPotatoes;
|
||||
private int numCarrots;
|
||||
private int numMeat;
|
||||
@ -48,16 +53,15 @@ public class Stew {
|
||||
* Mix the stew
|
||||
*/
|
||||
public void mix() {
|
||||
System.out.println(String.format(
|
||||
"Mixing the stew we find: %d potatoes, %d carrots, %d meat and %d peppers", numPotatoes,
|
||||
numCarrots, numMeat, numPeppers));
|
||||
LOGGER.info("Mixing the stew we find: {} potatoes, {} carrots, {} meat and {} peppers",
|
||||
numPotatoes, numCarrots, numMeat, numPeppers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Taste the stew
|
||||
*/
|
||||
public void taste() {
|
||||
System.out.println("Tasting the stew");
|
||||
LOGGER.info("Tasting the stew");
|
||||
if (numPotatoes > 0) {
|
||||
numPotatoes--;
|
||||
}
|
||||
|
Reference in New Issue
Block a user