#502 Replaced usages of System.out with logger.
This commit is contained in:
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.callback;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* Callback pattern is more native for functional languages where functions are treated as
|
||||
@ -31,6 +34,8 @@ package com.iluwatar.callback;
|
||||
*/
|
||||
public class App {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
*/
|
||||
@ -39,7 +44,7 @@ public class App {
|
||||
Callback callback = new Callback() {
|
||||
@Override
|
||||
public void call() {
|
||||
System.out.println("I'm done now.");
|
||||
LOGGER.info("I'm done now.");
|
||||
}
|
||||
};
|
||||
task.executeWith(callback);
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.callback;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* This example generates the exact same output as {@link App} however the callback has been
|
||||
@ -30,12 +33,14 @@ package com.iluwatar.callback;
|
||||
*/
|
||||
public class LambdasApp {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LambdasApp.class);
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
Task task = new SimpleTask();
|
||||
Callback c = () -> System.out.println("I'm done now.");
|
||||
Callback c = () -> LOGGER.info("I'm done now.");
|
||||
task.executeWith(c);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.callback;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* Implementation of task that need to be executed
|
||||
@ -29,8 +32,10 @@ package com.iluwatar.callback;
|
||||
*/
|
||||
public class SimpleTask extends Task {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleTask.class);
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
System.out.println("Perform some important activity and after call the callback method.");
|
||||
LOGGER.info("Perform some important activity and after call the callback method.");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user