Skip to content

Commit

Permalink
feat: TimeLogger (#127)
Browse files Browse the repository at this point in the history
* feat: TimeLogger

* refactor: ktlintformat
  • Loading branch information
toychip authored Aug 31, 2024
1 parent b02263b commit d18ea81
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions api/src/main/kotlin/com/mashup/dojo/common/TimeLogger.kt
Original file line number Diff line number Diff line change
@@ -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")
}
}

0 comments on commit d18ea81

Please sign in to comment.