mirror of https://github.com/status-im/timbre.git
[#207] Add docstring for `with-context`
This commit is contained in:
parent
d8d667aea4
commit
594e518c8e
|
@ -277,13 +277,16 @@
|
||||||
|
|
||||||
;;;; Internal logging core
|
;;;; Internal logging core
|
||||||
|
|
||||||
(def ^:dynamic *context*
|
(def ^:dynamic *context* "General-purpose dynamic logging context" nil)
|
||||||
"General-purpose dynamic logging context. Context will be included in
|
(defmacro with-context
|
||||||
appender data map at logging time."
|
"Executes body so that given arbitrary data will be included in the
|
||||||
nil)
|
data map passed to appenders for any enclosed logging calls.
|
||||||
|
|
||||||
(defmacro with-context [context & body]
|
(with-context
|
||||||
`(binding [*context* ~context] ~@body))
|
{:user-name \"Stu\"} ; Will be incl. in data dispatched to appenders
|
||||||
|
(info \"User request\"))"
|
||||||
|
|
||||||
|
[context & body] `(binding [*context* ~context] ~@body))
|
||||||
|
|
||||||
(defn- next-vargs [v] (if (> (count v) 1) (subvec v 1) []))
|
(defn- next-vargs [v] (if (> (count v) 1) (subvec v 1) []))
|
||||||
(defn- vargs->margs
|
(defn- vargs->margs
|
||||||
|
|
Loading…
Reference in New Issue