diff --git a/src/taoensso/timbre.clj b/src/taoensso/timbre.clj index 5ed2b80..659dbf4 100644 --- a/src/taoensso/timbre.clj +++ b/src/taoensso/timbre.clj @@ -113,7 +113,7 @@ (catch java.io.IOException _))))}}})) (defn set-config! [ks val] (swap! config assoc-in ks val)) -(defn merge-config! [& maps] (apply swap! config utils/deep-merge maps)) +(defn merge-config! [& maps] (apply swap! config utils/merge-deep maps)) (defn set-level! [level] (set-config! [:current-level] level)) diff --git a/src/taoensso/timbre/utils.clj b/src/taoensso/timbre/utils.clj index 33af150..6a66180 100644 --- a/src/taoensso/timbre/utils.clj +++ b/src/taoensso/timbre/utils.clj @@ -25,12 +25,12 @@ (swap! cache assoc args {:time-cached now :d-result d-result}) @d-result)))))) -(defn deep-merge-with ; From clojure.contrib.map-utils +(defn merge-deep-with ; From clojure.contrib.map-utils "Like `merge-with` but merges maps recursively, applying the given fn only when there's a non-map at a particular level. - (deepmerge-with + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4} - {:a {:b {:c 2 :d {:z 9} :z 3} :e 100}}) + (merge-deep-with + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4} + {:a {:b {:c 2 :d {:z 9} :z 3} :e 100}}) => {:a {:b {:z 3, :c 3, :d {:z 9, :x 1, :y 2}}, :e 103}, :f 4}" [f & maps] (apply @@ -40,9 +40,9 @@ (apply f maps))) maps)) -(def deep-merge (partial deep-merge-with (fn [x y] y))) +(def merge-deep (partial merge-deep-with (fn [x y] y))) -(comment (deep-merge {:a {:b {:c {:d :D :e :E}}}} +(comment (merge-deep {:a {:b {:c {:d :D :e :E}}}} {:a {:b {:g :G :c {:c {:f :F}}}}})) (defn round-to