From d18ea815c558bfda764ac71502003996f0dc0a1a Mon Sep 17 00:00:00 2001 From: Junhyoung Lim <109949924+toychip@users.noreply.github.com> Date: Sat, 31 Aug 2024 14:44:00 +0900 Subject: [PATCH] feat: TimeLogger (#127) * feat: TimeLogger * refactor: ktlintformat --- .../com/mashup/dojo/common/TimeLogger.kt | 20 +++++++++++++++++++ 1 file changed, 20 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..2a7936e0 --- /dev/null +++ b/api/src/main/kotlin/com/mashup/dojo/common/TimeLogger.kt @@ -0,0 +1,20 @@ +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") + } +}