#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
@@ -35,6 +35,8 @@ import com.iluwatar.servicelayer.spellbook.SpellbookDaoImpl;
import com.iluwatar.servicelayer.wizard.Wizard;
import com.iluwatar.servicelayer.wizard.WizardDao;
import com.iluwatar.servicelayer.wizard.WizardDaoImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
@@ -57,6 +59,8 @@ import com.iluwatar.servicelayer.wizard.WizardDaoImpl;
*/
public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
/**
* Program entry point
*
@@ -180,27 +184,27 @@ public class App {
public static void queryData() {
MagicService service =
new MagicServiceImpl(new WizardDaoImpl(), new SpellbookDaoImpl(), new SpellDaoImpl());
System.out.println("Enumerating all wizards");
LOGGER.info("Enumerating all wizards");
for (Wizard w : service.findAllWizards()) {
System.out.println(w.getName());
LOGGER.info(w.getName());
}
System.out.println("Enumerating all spellbooks");
LOGGER.info("Enumerating all spellbooks");
for (Spellbook s : service.findAllSpellbooks()) {
System.out.println(s.getName());
LOGGER.info(s.getName());
}
System.out.println("Enumerating all spells");
LOGGER.info("Enumerating all spells");
for (Spell s : service.findAllSpells()) {
System.out.println(s.getName());
LOGGER.info(s.getName());
}
System.out.println("Find wizards with spellbook 'Book of Idores'");
LOGGER.info("Find wizards with spellbook 'Book of Idores'");
List<Wizard> wizardsWithSpellbook = service.findWizardsWithSpellbook("Book of Idores");
for (Wizard w : wizardsWithSpellbook) {
System.out.println(String.format("%s has 'Book of Idores'", w.getName()));
LOGGER.info("{} has 'Book of Idores'", w.getName());
}
System.out.println("Find wizards with spell 'Fireball'");
LOGGER.info("Find wizards with spell 'Fireball'");
List<Wizard> wizardsWithSpell = service.findWizardsWithSpell("Fireball");
for (Wizard w : wizardsWithSpell) {
System.out.println(String.format("%s has 'Fireball'", w.getName()));
LOGGER.info("{} has 'Fireball'", w.getName());
}
}
}