From 76099ddc99d05422b832d2d44229ddd090dca479 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Wed, 20 Apr 2022 11:23:29 +0200 Subject: [PATCH] Added logger properties and fixed some bugs. --- pom.xml | 2 +- .../nl/andrewl/distribugit/DistribuGit.java | 8 ++++- src/main/resources/simplelogger.properties | 34 +++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/simplelogger.properties diff --git a/pom.xml b/pom.xml index 05947e3..7f1d4e2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ nl.andrewl distribugit - 1.1.0 + 1.2.0 17 diff --git a/src/main/java/nl/andrewl/distribugit/DistribuGit.java b/src/main/java/nl/andrewl/distribugit/DistribuGit.java index 952bab7..db9dced 100644 --- a/src/main/java/nl/andrewl/distribugit/DistribuGit.java +++ b/src/main/java/nl/andrewl/distribugit/DistribuGit.java @@ -103,12 +103,18 @@ public class DistribuGit { statusListener.messageReceived("Prepared temporary directory for repositories."); List repositoryURIs; try { + statusListener.messageReceived("Fetching repository URIs."); repositoryURIs = selector.getURIs(); } catch (Exception e) { throw new IOException("Could not fetch repository URIs.", e); } + if (repositoryURIs.isEmpty()) { + statusListener.messageReceived("No repositories were found."); + statusListener.progressUpdated(100f); + return; + } try { - stepsTotal = 3 * repositoryURIs.size(); + stepsTotal = (finalizationAction == null ? 2 : 3) * repositoryURIs.size(); Map repos = downloadRepositories(repositoryURIs); applyActionToRepositories(repos, action); if (finalizationAction != null) { diff --git a/src/main/resources/simplelogger.properties b/src/main/resources/simplelogger.properties new file mode 100644 index 0000000..9aacb8f --- /dev/null +++ b/src/main/resources/simplelogger.properties @@ -0,0 +1,34 @@ +# SLF4J's SimpleLogger configuration file +# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. + +# Default logging detail level for all instances of SimpleLogger. +# Must be one of ("trace", "debug", "info", "warn", or "error"). +# If not specified, defaults to "info". +org.slf4j.simpleLogger.defaultLogLevel=error + +# Logging detail level for a SimpleLogger instance named "xxxxx". +# Must be one of ("trace", "debug", "info", "warn", or "error"). +# If not specified, the default logging detail level is used. +#org.slf4j.simpleLogger.log.xxxxx= + +# Set to true if you want the current date and time to be included in output messages. +# Default is false, and will output the number of milliseconds elapsed since startup. +#org.slf4j.simpleLogger.showDateTime=false + +# The date and time format to be used in the output messages. +# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. +# If the format is not specified or is invalid, the default format is used. +# The default format is yyyy-MM-dd HH:mm:ss:SSS Z. +#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z + +# Set to true if you want to output the current thread name. +# Defaults to true. +#org.slf4j.simpleLogger.showThreadName=true + +# Set to true if you want the Logger instance name to be included in output messages. +# Defaults to true. +#org.slf4j.simpleLogger.showLogName=true + +# Set to true if you want the last component of the name to be included in output messages. +# Defaults to false. +#org.slf4j.simpleLogger.showShortLogName=false \ No newline at end of file