🔊 Log options on startup
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 9 Nov 2024 16:48:15 +0000 (17:48 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 9 Nov 2024 16:48:15 +0000 (17:48 +0100)
src/main/java/net/pterodactylus/rhynodge/engine/Options.java
src/main/java/net/pterodactylus/rhynodge/engine/Starter.java

index 2914aa0..2803a83 100644 (file)
@@ -2,6 +2,8 @@ package net.pterodactylus.rhynodge.engine;
 
 import net.pterodactylus.util.envopt.Option;
 
+import java.util.StringJoiner;
+
 /**
  * Options for Rhynodge which must be set as environment variables.
  *
@@ -24,4 +26,15 @@ public class Options {
        @Option(name = "CHAIN_DIRECTORY", defaultValue = "chains")
        public final String chainDirectory = null;
 
+       @Override
+       public String toString() {
+               return new StringJoiner(", ", Options.class.getSimpleName() + "[", "]")
+                               .add("smtpHostname='" + smtpHostname + "'")
+                               .add("errorEmailSender='" + errorEmailSender + "'")
+                               .add("errorEmailRecipient='" + errorEmailRecipient + "'")
+                               .add("stateDirectory='" + stateDirectory + "'")
+                               .add("chainDirectory='" + chainDirectory + "'")
+                               .toString();
+       }
+
 }
index 2908ddd..3bcde3d 100644 (file)
@@ -19,6 +19,7 @@ package net.pterodactylus.rhynodge.engine;
 
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.logging.Logger;
 
 import net.pterodactylus.rhynodge.actions.EmailAction;
 import net.pterodactylus.rhynodge.loader.ChainWatcher;
@@ -45,6 +46,7 @@ public class Starter {
         */
        public static void main(String... arguments) throws IOException {
                Options options = Parser.fromSystemEnvironment().parseEnvironment(Options::new);
+               logger.info("Options: " + options);
                EmailAction errorEmailAction =
                                createErrorEmailAction(options.smtpHostname, options.errorEmailSender, options.errorEmailRecipient);
 
@@ -63,4 +65,6 @@ public class Starter {
                return new EmailAction(smtpHostname, errorEmailSender, errorEmailRecipient);
        }
 
+       private static final Logger logger = Logger.getLogger(Starter.class.getName());
+
 }