mirror of https://github.com/status-im/timbre.git
[#137] Add &args support to `swap-config!` (@rsslldnphy)
This commit is contained in:
parent
7c3afe499b
commit
e61fabf0d6
|
@ -130,9 +130,9 @@
|
||||||
(defmacro with-merged-config [config & body]
|
(defmacro with-merged-config [config & body]
|
||||||
`(binding [*config* (enc/nested-merge *config* ~config)] ~@body))
|
`(binding [*config* (enc/nested-merge *config* ~config)] ~@body))
|
||||||
|
|
||||||
(defn swap-config! [f]
|
(defn swap-config! [f & args]
|
||||||
#+cljs (set! *config* (f *config*))
|
#+cljs (set! *config* (apply f *config* args))
|
||||||
#+clj (alter-var-root #'*config* f))
|
#+clj (apply alter-var-root #'*config* f args))
|
||||||
|
|
||||||
(defn set-config! [m] (swap-config! (fn [_old] m)))
|
(defn set-config! [m] (swap-config! (fn [_old] m)))
|
||||||
(defn merge-config! [m] (swap-config! (fn [old] (enc/nested-merge old m))))
|
(defn merge-config! [m] (swap-config! (fn [old] (enc/nested-merge old m))))
|
||||||
|
|
Loading…
Reference in New Issue