From bd036eb29ff4ed29ceccd83ba44b24c295fccb3d Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 11 Oct 2024 13:45:16 +0200 Subject: [PATCH] Add MyCustomFormat.kt example to documentation Closes gh-42594 --- .../structured/otherformats/MyCustomFormat.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/logging/structured/otherformats/MyCustomFormat.kt diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/logging/structured/otherformats/MyCustomFormat.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/logging/structured/otherformats/MyCustomFormat.kt new file mode 100644 index 00000000000..fda3abb3571 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/logging/structured/otherformats/MyCustomFormat.kt @@ -0,0 +1,12 @@ +package org.springframework.boot.docs.features.logging.structured.otherformats + +import ch.qos.logback.classic.spi.ILoggingEvent +import org.springframework.boot.logging.structured.StructuredLogFormatter + +class MyCustomFormat : StructuredLogFormatter { + + override fun format(event: ILoggingEvent): String { + return "time=${event.instant} level=${event.level} message=${event.message}\n" + } + +}