Quarkus: On/off toggle via configuration.

Change-Id: I2b1b5796501784b4e21697fea85d5e1e12a3e12b
diff --git a/deployment/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/deployment/GoogleCloudLoggingProcessor.java b/deployment/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/deployment/GoogleCloudLoggingProcessor.java
index 7d4a93f..fdfcb1c 100644
--- a/deployment/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/deployment/GoogleCloudLoggingProcessor.java
+++ b/deployment/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/deployment/GoogleCloudLoggingProcessor.java
@@ -5,6 +5,7 @@
 package eu.mulk.quarkus.googlecloud.jsonlogging.deployment;
 
 import eu.mulk.quarkus.googlecloud.jsonlogging.runtime.GoogleCloudJsonLoggingRecorder;
+import eu.mulk.quarkus.googlecloud.jsonlogging.runtime.GoogleJsonLogConfig;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.annotations.ExecutionTime;
 import io.quarkus.deployment.annotations.Record;
@@ -38,7 +39,7 @@
    */
   @BuildStep
   @Record(ExecutionTime.RUNTIME_INIT)
-  public LogConsoleFormatBuildItem setUpFormatter(GoogleCloudJsonLoggingRecorder recorder) {
-    return new LogConsoleFormatBuildItem(recorder.initialize());
+  public LogConsoleFormatBuildItem setUpFormatter(GoogleCloudJsonLoggingRecorder recorder, GoogleJsonLogConfig config) {
+    return new LogConsoleFormatBuildItem(recorder.initialize(config));
   }
 }
diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingRecorder.java b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingRecorder.java
index 7366a55..8bdb308 100644
--- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingRecorder.java
+++ b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingRecorder.java
@@ -10,6 +10,7 @@
 import io.quarkus.arc.Arc;
 import io.quarkus.runtime.RuntimeValue;
 import io.quarkus.runtime.annotations.Recorder;
+
 import java.util.Collection;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -26,7 +27,10 @@
    *
    * @return the registered {@link Formatter}.
    */
-  public RuntimeValue<Optional<java.util.logging.Formatter>> initialize() {
+  public RuntimeValue<Optional<java.util.logging.Formatter>> initialize(GoogleJsonLogConfig config) {
+    if(!config.jsonGoogle.enable) {
+      return new RuntimeValue<>(Optional.empty());
+    }
 
     var parameterProviders =
         Arc.container().select(StructuredParameterProvider.class).stream()
@@ -37,4 +41,5 @@
 
     return new RuntimeValue<>(Optional.of(Formatter.load(parameterProviders, labelProviders)));
   }
+
 }
diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleJsonLogConfig.java b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleJsonLogConfig.java
new file mode 100644
index 0000000..b73b0bc
--- /dev/null
+++ b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleJsonLogConfig.java
@@ -0,0 +1,28 @@
+package eu.mulk.quarkus.googlecloud.jsonlogging.runtime;
+
+import io.quarkus.runtime.annotations.*;
+
+/**
+ * Configuration for Google JSON log formatting.
+ */
+@ConfigRoot(phase = ConfigPhase.RUN_TIME, name = "log.console")
+public class GoogleJsonLogConfig {
+
+    /**
+     * Console google json logging.
+     */
+    @ConfigDocSection
+    @ConfigItem(name = "json.google")
+    JsonConfig jsonGoogle;
+
+    @ConfigGroup
+    public static class JsonConfig {
+
+        /**
+         * Determine whether to enable the JSON console formatting extension, which disables "normal" console formatting.
+         */
+        @ConfigItem(name = ConfigItem.PARENT, defaultValue = "true")
+        boolean enable;
+
+    }
+}
\ No newline at end of file