File tree Expand file tree Collapse file tree
module/src/main/java/com/iluwatar/module Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,12 +45,8 @@ public final class App {
4545 public static void prepare () throws FileNotFoundException {
4646
4747 /* Create new singleton objects and prepare their modules */
48- fileLoggerModule = FileLoggerModule .getSingleton ();
49- consoleLoggerModule = ConsoleLoggerModule .getSingleton ();
50-
51- /* Prepare modules */
52- fileLoggerModule .prepare ();
53- consoleLoggerModule .prepare ();
48+ fileLoggerModule = FileLoggerModule .getSingleton ().prepare ();
49+ consoleLoggerModule = ConsoleLoggerModule .getSingleton ().prepare ();
5450 }
5551
5652 /**
Original file line number Diff line number Diff line change @@ -56,12 +56,14 @@ public static ConsoleLoggerModule getSingleton() {
5656 /**
5757 * Following method performs the initialization
5858 */
59- public void prepare () {
59+ public ConsoleLoggerModule prepare () {
6060
6161 LOGGER .debug ("ConsoleLoggerModule::prepare();" );
6262
6363 this .output = new PrintStream (System .out );
6464 this .error = new PrintStream (System .err );
65+
66+ return this ;
6567 }
6668
6769 /**
Original file line number Diff line number Diff line change @@ -64,12 +64,14 @@ public static FileLoggerModule getSingleton() {
6464 * @throws FileNotFoundException if program is not able to find log files (output.txt and
6565 * error.txt)
6666 */
67- public void prepare () throws FileNotFoundException {
67+ public FileLoggerModule prepare () throws FileNotFoundException {
6868
6969 LOGGER .debug ("FileLoggerModule::prepare();" );
7070
7171 this .output = new PrintStream (new FileOutputStream (OUTPUT_FILE ));
7272 this .error = new PrintStream (new FileOutputStream (ERROR_FILE ));
73+
74+ return this ;
7375 }
7476
7577 /**
You can’t perform that action at this time.
0 commit comments