Skip to content
Permalink
Browse files

Add timestamps to logger

  • Loading branch information...
swlkr committed Feb 16, 2019
1 parent 55fee3e commit 9694e6b1e0c3e490206930196d8c97f25c1aa7c0
Showing with 8 additions and 2 deletions.
  1. +3 −2 src/coast/logger.clj
  2. +5 −0 src/coast/time.clj
@@ -20,8 +20,9 @@
headers (->> (:headers response)
(utils/map-vals string/lower-case))
content-type (get headers "content-type")
route (:coast.router/name request)]
(str method " " uri " " route " " status " " content-type " " ms "ms")))
route (:coast.router/name request)
timestamp (time/fmt (time/offset) "yyyy-MM-dd HH:mm:ss xx")]
(str timestamp " " method " \"" uri "\" " route " " status " " content-type " " ms "ms")))

(defn log [request response start-time]
(println (log-str request response start-time)))
@@ -15,6 +15,11 @@
([tz]
(LocalDateTime/now (ZoneId/of tz))))


(defn offset []
(OffsetDateTime/now))


(defn local
([d tz]
(when (instance? java.util.Date d)

0 comments on commit 9694e6b

Please sign in to comment.
You can’t perform that action at this time.