mirror of
https://github.com/status-im/timbre.git
synced 2025-02-11 11:16:31 +00:00
Make ns-filter runtime again
The compile-time filtering can trip up in surprising ways, and doesn't work with tools.logging. This commit switches back to a runtime ns filter which is a teeny, tiny bit slower - but always predictable.
This commit is contained in:
parent
a1bf286084
commit
a6ecb2c1e6
@ -1,5 +1,4 @@
|
|||||||
## v2.5.0 → v2.6.0
|
## v2.5.0 → v2.6.1
|
||||||
* Perf: make ns filtering a compile-time check.
|
|
||||||
* Perf: add support for a compile-time logging level environment variable (`TIMBRE_LOG_LEVEL`). See `timbre/compile-time-level` docstring for details.
|
* Perf: add support for a compile-time logging level environment variable (`TIMBRE_LOG_LEVEL`). See `timbre/compile-time-level` docstring for details.
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
**[API docs](http://ptaoussanis.github.io/timbre/)** | **[CHANGELOG](https://github.com/ptaoussanis/timbre/blob/master/CHANGELOG.md)** | [contact & contributing](#contact--contributing) | [other Clojure libs](https://www.taoensso.com/clojure-libraries) | [Twitter](https://twitter.com/#!/ptaoussanis) | current [semantic](http://semver.org/) version:
|
**[API docs](http://ptaoussanis.github.io/timbre/)** | **[CHANGELOG](https://github.com/ptaoussanis/timbre/blob/master/CHANGELOG.md)** | [contact & contributing](#contact--contributing) | [other Clojure libs](https://www.taoensso.com/clojure-libraries) | [Twitter](https://twitter.com/#!/ptaoussanis) | current [semantic](http://semver.org/) version:
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
[com.taoensso/timbre "2.6.0"] ; See CHANGELOG for breaking changes since 1.x
|
[com.taoensso/timbre "2.6.1"] ; See CHANGELOG for breaking changes since 1.x
|
||||||
```
|
```
|
||||||
|
|
||||||
# Timbre, a (sane) Clojure logging & profiling library
|
# Timbre, a (sane) Clojure logging & profiling library
|
||||||
@ -27,7 +27,7 @@ Logging with Java can be maddeningly, unnecessarily hard. Particularly if all yo
|
|||||||
Add the necessary dependency to your [Leiningen](http://leiningen.org/) `project.clj` and `require` the library in your ns:
|
Add the necessary dependency to your [Leiningen](http://leiningen.org/) `project.clj` and `require` the library in your ns:
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
[com.taoensso/timbre "2.6.0"] ; project.clj
|
[com.taoensso/timbre "2.6.1"] ; project.clj
|
||||||
(ns my-app (:require [taoensso.timbre :as timbre
|
(ns my-app (:require [taoensso.timbre :as timbre
|
||||||
:refer (trace debug info warn error fatal spy with-log-level)])) ; ns
|
:refer (trace debug info warn error fatal spy with-log-level)])) ; ns
|
||||||
```
|
```
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
(defproject com.taoensso/timbre "2.6.0"
|
(defproject com.taoensso/timbre "2.6.1"
|
||||||
:description "Clojure logging & profiling library"
|
:description "Clojure logging & profiling library"
|
||||||
:url "https://github.com/ptaoussanis/timbre"
|
:url "https://github.com/ptaoussanis/timbre"
|
||||||
:license {:name "Eclipse Public License"
|
:license {:name "Eclipse Public License"
|
||||||
|
@ -334,13 +334,13 @@
|
|||||||
|
|
||||||
(defmacro logging-enabled?
|
(defmacro logging-enabled?
|
||||||
"Returns true iff current logging level is sufficient and current namespace
|
"Returns true iff current logging level is sufficient and current namespace
|
||||||
unfiltered. The namespace test is compile-time, the logging-level test
|
unfiltered. The namespace test is runtime, the logging-level test compile-time
|
||||||
compile-time iff a compile-time logging level was specified."
|
iff a compile-time logging level was specified."
|
||||||
[level & body]
|
[level]
|
||||||
(when (@ns-filter-cache *ns*)
|
(if compile-time-level
|
||||||
(if compile-time-level
|
(when (sufficient-level? level)
|
||||||
(sufficient-level? level)
|
`(@ns-filter-cache *ns*))
|
||||||
`(sufficient-level? ~level))))
|
`(and (sufficient-level? ~level) (@ns-filter-cache *ns*))))
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(def compile-time-level :info)
|
(def compile-time-level :info)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user