From 93ecfd1e0c1d1e40fb17e580a7a11de35383ef79 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 15 Jan 2022 14:03:41 +0100 Subject: Load providers registered through the ServiceLoader mechanism. Change-Id: I392e78b34c8330e9b4c06d57b1423ca552ba6fc1 --- .../jsonlogging/example/RandomNumberParameterProvider.java | 14 ++++++++++++++ ...kus.googlecloud.jsonlogging.StructuredParameterProvider | 1 + 2 files changed, 15 insertions(+) create mode 100644 example/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/example/RandomNumberParameterProvider.java create mode 100644 example/src/main/resources/META-INF/services/eu.mulk.quarkus.googlecloud.jsonlogging.StructuredParameterProvider (limited to 'example') diff --git a/example/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/example/RandomNumberParameterProvider.java b/example/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/example/RandomNumberParameterProvider.java new file mode 100644 index 0000000..7e4158c --- /dev/null +++ b/example/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/example/RandomNumberParameterProvider.java @@ -0,0 +1,14 @@ +package eu.mulk.quarkus.googlecloud.jsonlogging.example; + +import eu.mulk.quarkus.googlecloud.jsonlogging.KeyValueParameter; +import eu.mulk.quarkus.googlecloud.jsonlogging.StructuredParameter; +import eu.mulk.quarkus.googlecloud.jsonlogging.StructuredParameterProvider; +import java.util.concurrent.ThreadLocalRandom; + +public class RandomNumberParameterProvider implements StructuredParameterProvider { + + @Override + public StructuredParameter getParameter() { + return KeyValueParameter.of("randomNumber", ThreadLocalRandom.current().nextInt()); + } +} diff --git a/example/src/main/resources/META-INF/services/eu.mulk.quarkus.googlecloud.jsonlogging.StructuredParameterProvider b/example/src/main/resources/META-INF/services/eu.mulk.quarkus.googlecloud.jsonlogging.StructuredParameterProvider new file mode 100644 index 0000000..c0017e6 --- /dev/null +++ b/example/src/main/resources/META-INF/services/eu.mulk.quarkus.googlecloud.jsonlogging.StructuredParameterProvider @@ -0,0 +1 @@ +eu.mulk.quarkus.googlecloud.jsonlogging.example.RandomNumberParameterProvider -- cgit v1.2.3