Skip to content

Commit

Permalink
[mod] [BREAKING] Default (nil) :min-level changed from :report -> `…
Browse files Browse the repository at this point in the history
…:trace`

The majority of users won't be affected by this.
The change only affects folks that have no :min-level in their config.

Motivation:
	The new default is more sensible: a nil/non-existant :min-level
	should mean literally "no minimum level".

Note: this change also affects users of the (long-ago deprecated)
`log?` and `may-log?` utils.
  • Loading branch information
ptaoussanis committed Oct 23, 2022
1 parent 1024373 commit 12457d9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/taoensso/timbre.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@
(comment
(get-min-level :report [["foo" :info]] *ns*)
(let [ns *ns*]
(enc/qb 1e6 ; [128.1 191.52]
(get-min-level :report :info ns)
(get-min-level :report [["*" 0]] ns))))
(enc/qb 1e6 ; [53.48 99.33]
(get-min-level :report :info ns)
(get-min-level :report [["*" :info]] ns))))

(let [;; Legacy API unfortunately treated empty colls as allow-all
leglist (fn [x] (when x (if (#{[] #{}} x) nil x)))]
Expand All @@ -350,9 +350,9 @@
(defn #?(:clj may-log? :cljs ^:boolean may-log?)
"Implementation detail.
Returns true iff level and ns are runtime unfiltered."
([ level ] (may-log? :report level nil nil))
([ level ?ns-str ] (may-log? :report level ?ns-str nil))
([ level ?ns-str ?config] (may-log? :report level ?ns-str nil))
([ level ] (may-log? :trace level nil nil))
([ level ?ns-str ] (may-log? :trace level ?ns-str nil))
([ level ?ns-str ?config] (may-log? :trace level ?ns-str ?config))
([default-min-level level ?ns-str ?config]
(let [config (or ?config *config*) ; NB may also be appender map
min-level
Expand All @@ -375,7 +375,7 @@
true)
false)))))

(comment (qb 1e5 (may-log? :info))) ; 122.3
(comment (qb 1e6 (may-log? :info))) ; 120.4

;;;; Compile-time filtering

Expand Down

0 comments on commit 12457d9

Please sign in to comment.