From 30276c45a95fa95522a1b497a004cad8b45b26cb Mon Sep 17 00:00:00 2001 From: toychip Date: Sat, 31 Aug 2024 14:35:57 +0900 Subject: [PATCH] feat: TimeLogger --- .../com/mashup/dojo/common/TimeLogger.kt | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 api/src/main/kotlin/com/mashup/dojo/common/TimeLogger.kt diff --git a/api/src/main/kotlin/com/mashup/dojo/common/TimeLogger.kt b/api/src/main/kotlin/com/mashup/dojo/common/TimeLogger.kt new file mode 100644 index 00000000..f2f605e3 --- /dev/null +++ b/api/src/main/kotlin/com/mashup/dojo/common/TimeLogger.kt @@ -0,0 +1,21 @@ +package com.mashup.dojo.common + +import jakarta.annotation.PostConstruct +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.springframework.stereotype.Component +import java.time.ZonedDateTime +import java.time.format.DateTimeFormatter + +@Component +class TimeLogger { + + private val logger: Logger = LoggerFactory.getLogger(TimeLogger::class.java) + + @PostConstruct + fun logCurrentTime() { + val now = ZonedDateTime.now() + val formattedTime = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss Z")) + logger.info("Application started at: $formattedTime") + } +}