Offload date formatting shorthands to encore

This commit is contained in:
Peter Taoussanis 2015-11-06 13:40:11 +07:00
parent 47cf2121f6
commit 44a3798c93
1 changed files with 3 additions and 21 deletions

View File

@ -18,8 +18,8 @@
(:require-macros [taoensso.timbre :as timbre-macros :refer ()]))
(if (vector? taoensso.encore/encore-version)
(enc/assert-min-encore-version [2 11 0])
(enc/assert-min-encore-version 2.11))
(enc/assert-min-encore-version [2 26 0])
(enc/assert-min-encore-version 2.26))
;;;; Config
@ -377,25 +377,7 @@
(let [timestamp-opts (inherit-into :timestamp-opts
appender config
default-timestamp-opts)
{:keys [pattern locale timezone]} timestamp-opts
pattern
(case pattern
:iso8601 "yyyy-MM-dd HH:mm:ss.SSSZ"
:rss2 "EEE, dd MMM yyyy HH:mm:ss z"
pattern)
locale
(case locale
:jvm-default (java.util.Locale/getDefault)
locale)
timezone
(case timezone
:jvm-default (java.util.TimeZone/getDefault)
:utc (java.util.TimeZone/getTimeZone "UTC")
timezone)]
{:keys [pattern locale timezone]} timestamp-opts]
(.format (enc/simple-date-format pattern
{:locale locale :timezone timezone})
(:instant data))))