[#218] Fix nullary version of `timbre.tools.logging/use-timbre`

This commit is contained in:
Peter Taoussanis 2017-04-15 12:48:56 +02:00
parent b5c998b46b
commit 44ce7e8613
1 changed files with 6 additions and 5 deletions

View File

@ -10,20 +10,21 @@
[taoensso.encore :as enc]
[taoensso.timbre :as timbre]))
(defn- force-var "To support dynamic vars, etc."
[x] (if (var? x) (deref x) x))
(deftype Logger [logger-ns-str timbre-config]
clojure.tools.logging.impl/Logger
(enabled? [_ level]
;; No support for per-call config
(timbre/may-log? level logger-ns-str timbre-config))
(timbre/may-log? level logger-ns-str
(force-var timbre-config)))
(write! [_ level throwable message]
(timbre/log! level :p
[message] ; No support for pre-msg raw args
{:config ; No support for per-call config
(if (var? timbre-config)
@timbre-config ; Support dynamic vars, etc.
timbre-config)
{:config (force-var timbre-config) ; No support for per-call config
:?ns-str logger-ns-str
:?file nil ; No support
:?line nil ; ''