summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2024-08-26 20:13:27 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2024-08-26 20:13:27 +0200
commitcbe869533dac7a5c04ce1841c06f3ecba9b2e057 (patch)
tree1a6d3696df19d6df67c95111adff5d981b37ab87 /runtime
parent949f3341c64d0bd363b230b4bea918f295946f57 (diff)
fix!: Move from @ConfigRoot/@ConfigItem to @ConfigMapping.
The old way is deprecated. BREAKING CHANGE: This makes GoogleCloudJsonLoggingConfiguration into an interface (it was a class before) and its 'enabled' field into a method. Change-Id: I1a5db74e009ad5427ab7348ab6a6c34b970d4148
Diffstat (limited to 'runtime')
-rw-r--r--runtime/pom.xml17
-rw-r--r--runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingConfiguration.java17
-rw-r--r--runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingRecorder.java2
3 files changed, 12 insertions, 24 deletions
diff --git a/runtime/pom.xml b/runtime/pom.xml
index 720f0d2..04a9e35 100644
--- a/runtime/pom.xml
+++ b/runtime/pom.xml
@@ -84,23 +84,6 @@ SPDX-License-Identifier: LGPL-3.0-or-later
</path>
</annotationProcessorPaths>
</configuration>
- <executions>
- <execution>
- <id>default-compile</id>
- <configuration>
- <annotationProcessorPaths>
- <path>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-extension-processor</artifactId>
- <version>${quarkus.version}</version>
- </path>
- </annotationProcessorPaths>
- <compilerArgs>
- <arg>-AlegacyConfigRoot=true</arg>
- </compilerArgs>
- </configuration>
- </execution>
- </executions>
</plugin>
<plugin>
diff --git a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingConfiguration.java b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingConfiguration.java
index 21a4ca9..72d1cfa 100644
--- a/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingConfiguration.java
+++ b/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/runtime/GoogleCloudJsonLoggingConfiguration.java
@@ -4,19 +4,24 @@
package eu.mulk.quarkus.googlecloud.jsonlogging.runtime;
-import io.quarkus.runtime.annotations.ConfigItem;
-import io.quarkus.runtime.annotations.ConfigPhase;
+import static io.quarkus.runtime.annotations.ConfigPhase.RUN_TIME;
+
import io.quarkus.runtime.annotations.ConfigRoot;
+import io.smallrye.config.ConfigMapping;
+import io.smallrye.config.WithDefault;
+import io.smallrye.config.WithParentName;
/** Configuration for console logging in Google Cloud Logging JSON format. */
-@ConfigRoot(prefix = "quarkus.log.console", name = "google", phase = ConfigPhase.RUN_TIME)
-public class GoogleCloudJsonLoggingConfiguration {
+@ConfigMapping(prefix = "quarkus.log.console.google")
+@ConfigRoot(phase = RUN_TIME)
+public interface GoogleCloudJsonLoggingConfiguration {
/**
* Whether to enable Google Cloud Logging JSON logging to <code>stdout</code>/<code>stderr</code>.
*
* <p>Replaces the regular plain-text format for console logs.
*/
- @ConfigItem(defaultValue = "true", name = ConfigItem.PARENT)
- public boolean enabled;
+ @WithDefault("true")
+ @WithParentName
+ boolean enabled();
}
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 af09231..74b63c6 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
@@ -28,7 +28,7 @@ public class GoogleCloudJsonLoggingRecorder {
*/
public RuntimeValue<Optional<java.util.logging.Formatter>> initialize(
GoogleCloudJsonLoggingConfiguration configuration) {
- if (!configuration.enabled) {
+ if (!configuration.enabled()) {
return new RuntimeValue<>(Optional.empty());
}