From 834ea18e3b7892eca35258a7e87459e60e7e3eb0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 9 Nov 2024 17:48:15 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=94=8A=20Log=20options=20on=20startup?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../java/net/pterodactylus/rhynodge/engine/Options.java | 13 +++++++++++++ .../java/net/pterodactylus/rhynodge/engine/Starter.java | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/main/java/net/pterodactylus/rhynodge/engine/Options.java b/src/main/java/net/pterodactylus/rhynodge/engine/Options.java index 2914aa0..2803a83 100644 --- a/src/main/java/net/pterodactylus/rhynodge/engine/Options.java +++ b/src/main/java/net/pterodactylus/rhynodge/engine/Options.java @@ -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(); + } + } diff --git a/src/main/java/net/pterodactylus/rhynodge/engine/Starter.java b/src/main/java/net/pterodactylus/rhynodge/engine/Starter.java index 2908ddd..3bcde3d 100644 --- a/src/main/java/net/pterodactylus/rhynodge/engine/Starter.java +++ b/src/main/java/net/pterodactylus/rhynodge/engine/Starter.java @@ -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()); + } -- 2.7.4