diff --git a/README.md b/README.md index 1178aa7..60362cd 100644 --- a/README.md +++ b/README.md @@ -125,10 +125,9 @@ This is the biggest win over Java logging IMO. Here's `timbre/example-config` (a :output-fn ; (fn [data]) -> formatted output string ; (see `default-output-fn` for details) + :context ; *context* value at log time (see `with-context`) :profile-stats ; From `profile` macro - Also incl. any `*context*` keys (see `with-context`). - MIDDLEWARE Middleware are simple (fn [data]) -> ?data fns (applied left->right) that transform the data map dispatched to appender fns. If any middleware returns diff --git a/src/taoensso/timbre.cljx b/src/taoensso/timbre.cljx index 20b16ba..ceba165 100644 --- a/src/taoensso/timbre.cljx +++ b/src/taoensso/timbre.cljx @@ -96,10 +96,9 @@ :output-fn ; (fn [data]) -> formatted output string ; (see `default-output-fn` for details) + :context ; *context* value at log time (see `with-context`) :profile-stats ; From `profile` macro - Also incl. any `*context*` keys (see `with-context`). - MIDDLEWARE Middleware are simple (fn [data]) -> ?data fns (applied left->right) that transform the data map dispatched to appender fns. If any middleware returns @@ -298,8 +297,8 @@ ) (def ^:dynamic *context* - "General-purpose dynamic logging context. Context will be merged into - appender data map at logging time." nil) + "General-purpose dynamic logging context. Context will be included in appender + data map at logging time." nil) (defmacro with-context [context & body] `(binding [*context* ~context] ~@body)) (declare get-hostname) @@ -327,9 +326,13 @@ vargs*_ (delay (vsplit-err1 (force vargs_))) ?err_ (delay (get @vargs*_ 0)) vargs_ (delay (get @vargs*_ 1)) - data (merge ?base-data *context* + context *context* + data (merge ?base-data + ;; No, better nest than merge (appenders may want to pass + ;; along arb context w/o knowing context keys, etc.): + (when (map? context) context) ; DEPRECATED, for back compat {:config config ; Entire config! - ;; :context *context* ; Extra destructure's a nuisance + :context context :instant instant :level level :?ns-str ?ns-str