Add `merge-config!`

This commit is contained in:
Peter Taoussanis 2013-01-04 14:50:28 +07:00
parent f23b59119d
commit 222be9d48e
1 changed files with 6 additions and 4 deletions

View File

@ -44,8 +44,9 @@
Other keys include: :instant, :timestamp, :hostname, :ns, :error? Other keys include: :instant, :timestamp, :hostname, :ns, :error?
See source code for examples and `utils/deep-merge` for a convenient way See source code for examples.
to reconfigure appenders." See `set-config!`, `merge-config!`, `set-level!` for convenient config
editing."
(atom {:current-level :debug (atom {:current-level :debug
;;; Control log filtering by namespace patterns (e.g. ["my-app.*"]). ;;; Control log filtering by namespace patterns (e.g. ["my-app.*"]).
@ -87,8 +88,9 @@
:append true) :append true)
(catch java.io.IOException _))))}}})) (catch java.io.IOException _))))}}}))
(defn set-config! [[k & ks] val] (swap! config assoc-in (cons k ks) val)) (defn set-config! [[k & ks] val] (swap! config assoc-in (cons k ks) val))
(defn set-level! [level] (set-config! [:current-level] level)) (defn merge-config! [& maps] (apply swap! config utils/deep-merge maps))
(defn set-level! [level] (set-config! [:current-level] level))
;;;; Define and sort logging levels ;;;; Define and sort logging levels