#502 Replaced usages of System.out with logger.

This commit is contained in:
daniel-bryla
2016-10-23 19:59:03 +02:00
parent 4ca205c03c
commit 0438811489
154 changed files with 1155 additions and 792 deletions

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.flyweight;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -33,6 +36,8 @@ import java.util.List;
*/
public class AlchemistShop {
private static final Logger LOGGER = LoggerFactory.getLogger(AlchemistShop.class);
private List<Potion> topShelf;
private List<Potion> bottomShelf;
@ -88,13 +93,13 @@ public class AlchemistShop {
*/
public void enumerate() {
System.out.println("Enumerating top shelf potions\n");
LOGGER.info("Enumerating top shelf potions\n");
for (Potion p : topShelf) {
p.drink();
}
System.out.println("\nEnumerating bottom shelf potions\n");
LOGGER.info("Enumerating bottom shelf potions\n");
for (Potion p : bottomShelf) {
p.drink();

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.flyweight;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* HealingPotion
@ -29,8 +32,10 @@ package com.iluwatar.flyweight;
*/
public class HealingPotion implements Potion {
private static final Logger LOGGER = LoggerFactory.getLogger(HealingPotion.class);
@Override
public void drink() {
System.out.println("You feel healed. (Potion=" + System.identityHashCode(this) + ")");
LOGGER.info("You feel healed. (Potion={})", System.identityHashCode(this));
}
}

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.flyweight;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* HolyWaterPotion
@ -29,8 +32,10 @@ package com.iluwatar.flyweight;
*/
public class HolyWaterPotion implements Potion {
private static final Logger LOGGER = LoggerFactory.getLogger(HolyWaterPotion.class);
@Override
public void drink() {
System.out.println("You feel blessed. (Potion=" + System.identityHashCode(this) + ")");
LOGGER.info("You feel blessed. (Potion={})", System.identityHashCode(this));
}
}

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.flyweight;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* InvisibilityPotion
@ -29,8 +32,10 @@ package com.iluwatar.flyweight;
*/
public class InvisibilityPotion implements Potion {
private static final Logger LOGGER = LoggerFactory.getLogger(InvisibilityPotion.class);
@Override
public void drink() {
System.out.println("You become invisible. (Potion=" + System.identityHashCode(this) + ")");
LOGGER.info("You become invisible. (Potion={})", System.identityHashCode(this));
}
}

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.flyweight;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* PoisonPotion
@ -29,8 +32,10 @@ package com.iluwatar.flyweight;
*/
public class PoisonPotion implements Potion {
private static final Logger LOGGER = LoggerFactory.getLogger(PoisonPotion.class);
@Override
public void drink() {
System.out.println("Urgh! This is poisonous. (Potion=" + System.identityHashCode(this) + ")");
LOGGER.info("Urgh! This is poisonous. (Potion={})", System.identityHashCode(this));
}
}

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.flyweight;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* StrengthPotion
@ -29,8 +32,10 @@ package com.iluwatar.flyweight;
*/
public class StrengthPotion implements Potion {
private static final Logger LOGGER = LoggerFactory.getLogger(StrengthPotion.class);
@Override
public void drink() {
System.out.println("You feel strong. (Potion=" + System.identityHashCode(this) + ")");
LOGGER.info("You feel strong. (Potion={})", System.identityHashCode(this));
}
}