Skip to content

Commit

Permalink
Respect TIMBRE_LEVEL system property, default to log level to :info b…
Browse files Browse the repository at this point in the history
…efore timbre end user has had the chance to configure log level. Ref issue fzakaria#32
  • Loading branch information
ivarref committed Dec 3, 2019
1 parent adc5ca1 commit d6f4c3b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/slf4j_timbre/factory.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
:implements [org.slf4j.ILoggerFactory]
:state state
:init init)
(:require slf4j-timbre.adapter)
(:require slf4j-timbre.adapter
[taoensso.timbre :as timbre])
(:import
(com.github.fzakaria.slf4j.timbre TimbreLoggerFactory TimbreLoggerAdapter)))

(defonce bootstrapped (atom false))

(defn -init
[]
(when-not @bootstrapped
(reset! bootstrapped true)
(let [lvl (System/getProperty "TIMBRE_LEVEL" ":info")]
(timbre/set-level! (keyword (subs lvl 1)))))
[[] (atom {})])

(defn -getLogger
Expand Down

0 comments on commit d6f4c3b

Please sign in to comment.