From e369c51d6d81961ce750fc0cecb5d9ad9e5271d9 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Fri, 15 Apr 2022 20:54:52 +0200 Subject: Update Javadocs with @snippet tags. Change-Id: I22f440c6ced5b90cdebc1fdf068171e7baad180f --- .../googlecloud/jsonlogging/KeyValueParameter.java | 10 +++--- .../quarkus/googlecloud/jsonlogging/Label.java | 10 +++--- .../googlecloud/jsonlogging/LabelProvider.java | 10 +++--- .../jsonlogging/StructuredParameter.java | 4 +-- .../jsonlogging/StructuredParameterProvider.java | 8 ++--- .../logmanager/DefaultConsoleHandler.java | 12 +++---- .../googlecloud/jsonlogging/package-info.java | 38 +++++++++++----------- 7 files changed, 46 insertions(+), 46 deletions(-) (limited to 'core/src/main/java') diff --git a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.java index d8ab58d..ef5d06a 100644 --- a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/KeyValueParameter.java @@ -20,20 +20,20 @@ import javax.json.JsonValue; * *

Example: * - *

{@code
+ * {@snippet :
  * logger.infof("Application starting.", StructuredParameter.of("version", "1.0"));
- * }
+ * } * - * Result: + *

Result: * - *

{@code
+ * {@snippet lang="json" :
  * {
  *   "jsonPayload": {
  *     "message": "Application starting.",
  *     "version": "1.0"
  *   }
  * }
- * }
+ * } * * @see Label * @see StructuredParameter diff --git a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java index b46862e..d5a9000 100644 --- a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java @@ -14,20 +14,20 @@ import java.util.Objects; * *

Example: * - *

{@code
+ * {@snippet :
  * logger.logf("Request rejected: unauthorized.", Label.of("requestId", "123"));
- * }
+ * } * - * Result: + *

Result: * - *

{@code
+ * {@snippet lang="json" :
  * {
  *   "textPayload": "Request rejected: unauthorized.",
  *   "labels": {
  *     "requestId": "123"
  *   }
  * }
- * }
+ * } * * @see KeyValueParameter * @see StructuredParameter diff --git a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java index 0588fbb..7cca6a0 100644 --- a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/LabelProvider.java @@ -17,7 +17,7 @@ import java.util.Collection; * *

Example: * - *

{@code
+ * {@snippet :
  * @Singleton
  * @Unremovable
  * public final class RequestIdLabelProvider implements LabelProvider {
@@ -27,18 +27,18 @@ import java.util.Collection;
  *     return List.of(Label.of("requestId", RequestContext.current().getRequestId()));
  *   }
  * }
- * }
+ * } * - * Result: + *

Result: * - *

{@code
+ * {@snippet lang="json" :
  * {
  *   "textPayload": "Request rejected: unauthorized.",
  *   "labels": {
  *     "requestId": "123"
  *   }
  * }
- * }
+ * } * * @see StructuredParameterProvider */ diff --git a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.java index 9bc3c11..c233158 100644 --- a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameter.java @@ -14,12 +14,12 @@ import javax.json.JsonObjectBuilder; * *

Example: * - *

{@code
+ * {@snippet :
  * StructuredParameter p1 = ...;
  * StructuredParameter p2 = ...;
  *
  * logger.logf("Something interesting happened.", p1, p2);
- * }
+ * } * * @see KeyValueParameter * @see Label diff --git a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.java index 70bdce6..b8f80ce 100644 --- a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/StructuredParameterProvider.java @@ -15,7 +15,7 @@ package eu.mulk.quarkus.googlecloud.jsonlogging; * *

Example: * - *

{@code
+ * {@snippet :
  * @Singleton
  * @Unremovable
  * public final class TraceLogParameterProvider implements StructuredParameterProvider {
@@ -28,11 +28,11 @@ package eu.mulk.quarkus.googlecloud.jsonlogging;
  *     return () -> b;
  *   }
  * }
- * }
+ * } * * Result: * - *
{@code
+ * {@snippet lang="json" :
  * {
  *   "jsonPayload": {
  *     "message": "Request rejected: unauthorized.",
@@ -40,7 +40,7 @@ package eu.mulk.quarkus.googlecloud.jsonlogging;
  *     "spanId": "c7431b14630b633d"
  *   }
  * }
- * }
+ * } * * @see LabelProvider */ diff --git a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/logmanager/DefaultConsoleHandler.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/logmanager/DefaultConsoleHandler.java index 475a15d..61d2961 100644 --- a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/logmanager/DefaultConsoleHandler.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/logmanager/DefaultConsoleHandler.java @@ -18,9 +18,9 @@ import org.jboss.logmanager.handlers.ConsoleHandler; * java.util.logging.LogManager#readConfiguration(InputStream)}), you can use this handler by * setting the following properties: * - *
{@code
+ * {@snippet lang="properties" :
  * handlers = eu.mulk.quarkus.googlecloud.jsonlogging.logmanager.ConsoleHandler
- * }
+ * } * *

Note: You can use {@code org.slf4j.bridge.SLF4JBridgeHandler} from {@code * org.slf4j:jul-to-slf4j} instead if you also have {@code org.jboss.slf4j:slf4j-jboss-logmanager} @@ -36,15 +36,15 @@ import org.jboss.logmanager.handlers.ConsoleHandler; * below), you need to accompany this with an entry in {@code application.properties} that points to * your {@code logging.properties} file: * - *

{@code
+ * {@snippet lang="properties" :
  * logging.config = classpath:logging.properties
- * }
+ * } * *

In order to ensure that Spring Boot chooses {@code JavaLoggingSystem} over other * implementations, make sure that no other logging backends are present on the class path. A simple * way of doing this is by relying on {@code spring-boot-starter-logging} while excluding Logback: * - *

{@code
+ * {@snippet lang="xml" :
  * 
  *   org.springframework.boot
  *   spring-boot-starter
@@ -55,7 +55,7 @@ import org.jboss.logmanager.handlers.ConsoleHandler;
  *     
  *   
  * 
- * }
+ * } * *

You will probably want to include at least {@code org.jboss.slf4j:slf4j-jboss-logmanager} as * well. In addition, {@code org.slf4j:jcl-over-slf4j}, {@code diff --git a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/package-info.java b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/package-info.java index 8f8e495..93cf21e 100644 --- a/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/package-info.java +++ b/core/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/package-info.java @@ -33,7 +33,7 @@ * *

Installation with Maven

* - *
{@code
+ * {@snippet lang="xml" :
  * 
  *   ...
  *
@@ -51,19 +51,19 @@
  *
  *   ...
  * 
- * }
+ * } * *

Installation with Gradle

* - *
{@code
+ * {@snippet lang="groovy" :
  * dependencies {
- *   ...
+ *   // ...
  *
  *   implementation("eu.mulk.quarkus-googlecloud-jsonlogging:quarkus-googlecloud-jsonlogging-core:4.0.0")
  *
- *   ...
+ *   // ...
+ * }
  * }
- * }
* *

Usage

* @@ -94,18 +94,18 @@ * *

Example: * - *

{@code
+ * {@snippet :
  * logger.logf(
  *   "Request rejected: unauthorized.",
  *   Label.of("requestId", "123"),
  *   KeyValueParameter.of("resource", "/users/mulk"),
  *   KeyValueParameter.of("method", "PATCH"),
  *   KeyValueParameter.of("reason", "invalid token"));
- * }
+ * } * - * Result: + *

Result: * - *

{@code
+ * {@snippet lang="json" :
  * {
  *   "jsonPayload": {
  *     "message": "Request rejected: unauthorized.",
@@ -117,7 +117,7 @@
  *     "requestId": "123"
  *   }
  * }
- * }
+ * } * *

Using LabelProvider and StructuredParameterProvider

* @@ -138,7 +138,7 @@ * *

Example: * - *

{@code
+ * {@snippet :
  * @Singleton
  * @Unremovable
  * public final class TraceLogParameterProvider implements StructuredParameterProvider, LabelProvider {
@@ -156,11 +156,11 @@
  *     return List.of(Label.of("requestId", "123"));
  *   }
  * }
- * }
+ * } * * Result: * - *
{@code
+ * {@snippet lang="json" :
  * {
  *   "jsonPayload": {
  *     "message": "Request rejected: unauthorized.",
@@ -171,7 +171,7 @@
  *     "requestId": "123"
  *   }
  * }
- * }
+ * } * *

Using the Mapped Diagnostic Context

* @@ -180,15 +180,15 @@ * *

Example: * - *

{@code
+ * {@snippet :
  * MDC.put("resource", "/users/mulk");
  * MDC.put("method", "PATCH");
  * logger.logf("Request rejected: unauthorized.");
- * }
+ * } * * Result: * - *
{@code
+ * {@snippet lang="json" :
  * {
  *   "jsonPayload": {
  *     "message": "Request rejected: unauthorized.",
@@ -196,6 +196,6 @@
  *     "method": "PATCH"
  *   }
  * }
- * }
+ * } */ package eu.mulk.quarkus.googlecloud.jsonlogging; -- cgit v1.2.3