Skip to content

Commit

Permalink
[mod] [DEPRECATE] set-level! -> set-min-level!, with-level -> `…
Browse files Browse the repository at this point in the history
…with-min-level`

Motivation:

  The new names are clearer.
  Since levels aren't changed frequently, I believe the extra length is justified.
  • Loading branch information
ptaoussanis committed Oct 23, 2022
1 parent 9085a41 commit 98deeb7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/taoensso/timbre.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1052,9 +1052,6 @@
`(do (assert (<= 0 ~probability 1) "Probability: 0 <= p <= 1")
(when (< (rand) ~probability) ~@body)))

(defn set-level! [level] (swap-config! (fn [m] (assoc m :min-level level))))
(defmacro with-level [level & body] `(binding [*config* (assoc *config* :min-level ~level)] ~@body))

;;;; Deprecated

(enc/deprecated
Expand All @@ -1071,4 +1068,8 @@
([ ] `(log-env :debug))
([ level ] `(log-env ~level "&env"))
([ level name] `(log-env *config* ~level ~name))
([config level name] `(log* ~config ~level ~name "=>" (get-env)))))
([config level name] `(log* ~config ~level ~name "=>" (get-env))))

(defn set-level! "DEPRECATED, prefer `set-min-level!`" [level] (swap-config! (fn [m] (assoc m :min-level level))))
(defmacro with-level "DEPRECATED, prefer `with-min-level`" [level & body]
`(binding [*config* (assoc *config* :min-level ~level)] ~@body)))

0 comments on commit 98deeb7

Please sign in to comment.