#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

@ -23,6 +23,9 @@
package com.iluwatar.twin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This class represents a Ball which extends {@link GameItem} and implements the logic for ball
* item, like move and draw. It hold a reference of {@link BallThread} to delegate the suspend and
@ -30,6 +33,8 @@ package com.iluwatar.twin;
*/
public class BallItem extends GameItem {
private static final Logger LOGGER = LoggerFactory.getLogger(BallItem.class);
private boolean isSuspended;
private BallThread twin;
@ -41,11 +46,11 @@ public class BallItem extends GameItem {
@Override
public void doDraw() {
System.out.println("doDraw");
LOGGER.info("doDraw");
}
public void move() {
System.out.println("move");
LOGGER.info("move");
}
@Override

View File

@ -23,6 +23,9 @@
package com.iluwatar.twin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This class is a UI thread for drawing the {@link BallItem}, and provide the method for suspend
* and resume. It hold the reference of {@link BallItem} to delegate the draw task.
@ -31,6 +34,8 @@ package com.iluwatar.twin;
public class BallThread extends Thread {
private static final Logger LOGGER = LoggerFactory.getLogger(BallThread.class);
private BallItem twin;
private volatile boolean isSuspended;
@ -61,12 +66,12 @@ public class BallThread extends Thread {
public void suspendMe() {
isSuspended = true;
System.out.println("Begin to suspend BallThread");
LOGGER.info("Begin to suspend BallThread");
}
public void resumeMe() {
isSuspended = false;
System.out.println("Begin to resume BallThread");
LOGGER.info("Begin to resume BallThread");
}
public void stopMe() {

View File

@ -24,16 +24,21 @@
package com.iluwatar.twin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* GameItem is a common class which provides some common methods for game object.
*/
public abstract class GameItem {
private static final Logger LOGGER = LoggerFactory.getLogger(GameItem.class);
/**
* Template method, do some common logic before draw
*/
public void draw() {
System.out.println("draw");
LOGGER.info("draw");
doDraw();
}