From 877e21154e2bba1353588807369398661f4e15e7 Mon Sep 17 00:00:00 2001 From: leich Date: Mon, 4 Nov 2019 19:54:26 +0100 Subject: [PATCH] use Logger instead of System.out (GTFS library does not use that Logger) --- .../org/matsim/contrib/gtfs/GtfsConverter.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/matsim/contrib/gtfs/GtfsConverter.java b/src/main/java/org/matsim/contrib/gtfs/GtfsConverter.java index 72f639c..7b946ae 100644 --- a/src/main/java/org/matsim/contrib/gtfs/GtfsConverter.java +++ b/src/main/java/org/matsim/contrib/gtfs/GtfsConverter.java @@ -67,7 +67,7 @@ public void convert(){ } } } - System.out.println("Earliest date mentioned in feed: "+startDate); + log.info("Earliest date mentioned in feed: "+startDate); LocalDate endDate = LocalDate.MIN; for(Service service: this.feed.services.values()) { @@ -83,15 +83,15 @@ public void convert(){ } } - System.out.println("Latest date mentioned in feed: " + endDate); + log.info("Latest date mentioned in feed: " + endDate); // Get the used service Id for the chosen weekday and date List activeServiceIds = this.getActiveServiceIds(this.feed.services); - System.out.printf("Active Services: %d %s\n", activeServiceIds.size(), activeServiceIds); + log.info(String.format("Active Services: %d %s", activeServiceIds.size(), activeServiceIds)); // Get the Trips which are active today List activeTrips = feed.trips.values().stream().filter(trip -> feed.services.get(trip.service_id).activeOn(this.date)).collect(Collectors.toList()); - System.out.printf("Active Trips: %d %s\n", activeTrips.size(), activeTrips.stream().map(trip -> trip.trip_id).collect(Collectors.toList())); + log.info(String.format("Active Trips: %d %s", activeTrips.size(), activeTrips.stream().map(trip -> trip.trip_id).collect(Collectors.toList()))); // Create one TransitLine for each GTFS-Route which has an active trip activeTrips.stream().map(trip -> feed.routes.get(trip.route_id)).distinct().forEach(route -> { @@ -114,9 +114,9 @@ public void convert(){ this.convertTrips(activeTrips); if(activeTrips.isEmpty()){ - System.out.println("There are no converted trips. You might need to change the date for better results."); + log.warn("There are no converted trips. You might need to change the date for better results."); } - System.out.println("Conversion successfull"); + log.info("Conversion successfull"); } @@ -131,7 +131,7 @@ private void convertStops(){ private List getActiveServiceIds(Map services) { List serviceIds = new ArrayList<>(); - System.out.println("Used Date for active schedules: " + this.date.toString() + " (weekday: " + date.getDayOfWeek().toString() + "). If you want to choose another date, please specify it, before running the converter"); + log.info("Used Date for active schedules: " + this.date.toString() + " (weekday: " + date.getDayOfWeek().toString() + "). If you want to choose another date, please specify it, before running the converter"); for(Service service: services.values()){ if(service.activeOn(date)){ serviceIds.add(service.service_id); @@ -202,8 +202,8 @@ private void convertTrips(List trips) { } } } - System.out.println("Created schedule-based departures: " + scheduleDepartures); - System.out.println("Created frequency-based departures: " + frequencyDepartures); + log.info("Created schedule-based departures: " + scheduleDepartures); + log.info("Created frequency-based departures: " + frequencyDepartures); }