diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2022-01-15 14:03:41 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2022-01-15 14:27:26 +0100 |
commit | 93ecfd1e0c1d1e40fb17e580a7a11de35383ef79 (patch) | |
tree | 6265b4bfe75ddab0a566c6d1b32ca1391081fd9b /example | |
parent | 20210245e619658c2459c77223d9abe3c643a882 (diff) |
Load providers registered through the ServiceLoader mechanism.
Change-Id: I392e78b34c8330e9b4c06d57b1423ca552ba6fc1
Diffstat (limited to 'example')
2 files changed, 15 insertions, 0 deletions
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 |