summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2021-05-03 19:16:48 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2021-05-11 21:49:24 +0200
commit4bae5f13fb592f78d5ce714641120a1473700f9a (patch)
treee4649978d6a31e1dbeaecf73a98dd2409932c104
parentc8144a9c60279f8dc81b2506794acd24df31b9a3 (diff)
Add Spotless.
Change-Id: I041c85d67e9eab6711510aae2df35b09e88707e8
-rw-r--r--pom.xml21
-rw-r--r--runtime/src/main/java/eu/mulk/quarkus/observability/googlecloud/jsonlogging/GoogleCloudLogEntry.java14
-rw-r--r--runtime/src/main/java/eu/mulk/quarkus/observability/googlecloud/jsonlogging/GoogleCloudLoggingFormatter.java9
3 files changed, 31 insertions, 13 deletions
diff --git a/pom.xml b/pom.xml
index a4e7701..0881faa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,6 +25,7 @@
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<failsafe-plugin.version>${surefire-plugin.version}</failsafe-plugin.version>
<quarkus.version>1.13.3.Final</quarkus.version>
+ <spotless-plugin.version>2.10.3</spotless-plugin.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
</properties>
@@ -76,6 +77,26 @@
</plugin>
</plugins>
</pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>com.diffplug.spotless</groupId>
+ <artifactId>spotless-maven-plugin</artifactId>
+ <version>${spotless-plugin.version}</version>
+ <configuration>
+ <java>
+ <removeUnusedImports/>
+ <importOrder>
+ <order>java,javax,org,com,de,io,dagger,eu.mulk,</order>
+ </importOrder>
+ <googleJavaFormat>
+ <version>${google.java.format.version}</version>
+ <style>GOOGLE</style>
+ </googleJavaFormat>
+ </java>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
</project>
diff --git a/runtime/src/main/java/eu/mulk/quarkus/observability/googlecloud/jsonlogging/GoogleCloudLogEntry.java b/runtime/src/main/java/eu/mulk/quarkus/observability/googlecloud/jsonlogging/GoogleCloudLogEntry.java
index 3f5a836..0450d0c 100644
--- a/runtime/src/main/java/eu/mulk/quarkus/observability/googlecloud/jsonlogging/GoogleCloudLogEntry.java
+++ b/runtime/src/main/java/eu/mulk/quarkus/observability/googlecloud/jsonlogging/GoogleCloudLogEntry.java
@@ -8,8 +8,8 @@ import javax.json.bind.annotation.JsonbProperty;
/**
* A JSON log entry compatible with Google Cloud Logging.
*
- * <p>Roughly (but not quite) corresponds to Google Cloud Logging's
- * <a href="https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry">LogEntry</a>
+ * <p>Roughly (but not quite) corresponds to Google Cloud Logging's <a
+ * href="https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry">LogEntry</a>
* structure.
*/
public record GoogleCloudLogEntry(
@@ -25,14 +25,10 @@ public record GoogleCloudLogEntry(
@Nullable String getNestedDiagnosticContext,
@Nullable @JsonbProperty("@type") String getType) {
- static public record SourceLocation(
- @Nullable String getFile,
- @Nullable String getLine,
- @Nullable String getFunction) {}
+ public static record SourceLocation(
+ @Nullable String getFile, @Nullable String getLine, @Nullable String getFunction) {}
- static public record Timestamp(
- long getSeconds,
- int getNanos) {
+ public static record Timestamp(long getSeconds, int getNanos) {
public Timestamp(Instant t) {
this(t.getEpochSecond(), t.getNano());
diff --git a/runtime/src/main/java/eu/mulk/quarkus/observability/googlecloud/jsonlogging/GoogleCloudLoggingFormatter.java b/runtime/src/main/java/eu/mulk/quarkus/observability/googlecloud/jsonlogging/GoogleCloudLoggingFormatter.java
index a44e8b5..3ec1fcc 100644
--- a/runtime/src/main/java/eu/mulk/quarkus/observability/googlecloud/jsonlogging/GoogleCloudLoggingFormatter.java
+++ b/runtime/src/main/java/eu/mulk/quarkus/observability/googlecloud/jsonlogging/GoogleCloudLoggingFormatter.java
@@ -54,7 +54,10 @@ class GoogleCloudLoggingFormatter extends ExtFormatter {
var sourceLocation =
new GoogleCloudLogEntry.SourceLocation(
- logRecord.getSourceFileName(), String.valueOf(logRecord.getSourceLineNumber()), String.format("%s.%s", logRecord.getSourceClassName(), logRecord.getSourceMethodName()));
+ logRecord.getSourceFileName(),
+ String.valueOf(logRecord.getSourceLineNumber()),
+ String.format(
+ "%s.%s", logRecord.getSourceClassName(), logRecord.getSourceMethodName()));
var entry =
new GoogleCloudLogEntry(
@@ -96,9 +99,7 @@ class GoogleCloudLoggingFormatter extends ExtFormatter {
return messageStringWriter.toString();
}
- /**
- * Computes the Google Cloud Logging severity corresponding to a given {@link Level}.
- */
+ /** Computes the Google Cloud Logging severity corresponding to a given {@link Level}. */
private static String severityOf(Level level) {
if (level.intValue() < 500) {
return TRACE_LEVEL;