12
12
import org .ipea .r5r .RDataFrame ;
13
13
import org .ipea .r5r .RoutingProperties ;
14
14
import org .ipea .r5r .Utils .Utils ;
15
+ import org .slf4j .Logger ;
16
+ import org .slf4j .LoggerFactory ;
15
17
16
18
import java .io .*;
17
19
import java .text .ParseException ;
@@ -61,6 +63,8 @@ public abstract class R5Process {
61
63
62
64
protected abstract boolean isOneToOne ();
63
65
66
+ private static final Logger LOG = LoggerFactory .getLogger ("org.ipea.r5r.Process.R5RProcess" );
67
+
64
68
public R5Process (ForkJoinPool threadPool , TransportNetwork transportNetwork , RoutingProperties routingProperties ) {
65
69
this .r5rThreadPool = threadPool ;
66
70
this .transportNetwork = transportNetwork ;
@@ -80,9 +84,7 @@ public RDataFrame run() throws ExecutionException, InterruptedException {
80
84
filter (Objects ::nonNull ).
81
85
collect (Collectors .toList ())).get ();
82
86
83
- if (!Utils .verbose & Utils .progress ) {
84
- System .out .print (".. DONE!\n " );
85
- }
87
+ LOG .info (".. DONE!\n " );
86
88
87
89
RDataFrame results = mergeResults (processResults );
88
90
@@ -197,9 +199,8 @@ private RDataFrame tryRunProcess(AtomicInteger totalProcessed, int index) {
197
199
results .clear ();
198
200
}
199
201
200
- if (!Utils .verbose & Utils .progress ) {
201
- System .out .print ("\r " + totalProcessed .getAndIncrement () + " out of " + nOrigins + " origins processed." );
202
- }
202
+ LOG .info ("\r {} out of {} origins processed." , totalProcessed .getAndIncrement (), nOrigins );
203
+
203
204
} catch (ParseException | FileNotFoundException e ) {
204
205
e .printStackTrace ();
205
206
}
@@ -224,9 +225,7 @@ private String getCsvFilename(int index) {
224
225
protected abstract RDataFrame runProcess (int index ) throws ParseException ;
225
226
226
227
private RDataFrame mergeResults (List <RDataFrame > processResults ) {
227
- if (!Utils .verbose & Utils .progress ) {
228
- System .out .print ("Consolidating results..." );
229
- }
228
+ LOG .info ("Consolidating results..." );
230
229
231
230
int nRows ;
232
231
nRows = processResults .stream ()
@@ -252,9 +251,7 @@ private RDataFrame mergeResults(List<RDataFrame> processResults) {
252
251
);
253
252
mergedDataFrame .updateRowCount ();
254
253
255
- if (!Utils .verbose & Utils .progress ) {
256
- System .out .print (" DONE!\n " );
257
- }
254
+ LOG .info (" DONE!\n " );
258
255
259
256
return mergedDataFrame ;
260
257
}
0 commit comments