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:
Peter Taoussanis 2013-08-22 21:58:25 +07:00
parent a1bf286084
commit a6ecb2c1e6
4 changed files with 11 additions and 12 deletions

View File

@ -1,5 +1,4 @@
## v2.5.0 → v2.6.0
* Perf: make ns filtering a compile-time check.
## v2.5.0 → v2.6.1
* Perf: add support for a compile-time logging level environment variable (`TIMBRE_LOG_LEVEL`). See `timbre/compile-time-level` docstring for details.

View File

@ -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:
```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
@ -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:
```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
:refer (trace debug info warn error fatal spy with-log-level)])) ; ns
```

View File

@ -1,4 +1,4 @@
(defproject com.taoensso/timbre "2.6.0"
(defproject com.taoensso/timbre "2.6.1"
:description "Clojure logging & profiling library"
:url "https://github.com/ptaoussanis/timbre"
:license {:name "Eclipse Public License"

View File

@ -334,13 +334,13 @@
(defmacro logging-enabled?
"Returns true iff current logging level is sufficient and current namespace
unfiltered. The namespace test is compile-time, the logging-level test
compile-time iff a compile-time logging level was specified."
[level & body]
(when (@ns-filter-cache *ns*)
(if compile-time-level
(sufficient-level? level)
`(sufficient-level? ~level))))
unfiltered. The namespace test is runtime, the logging-level test compile-time
iff a compile-time logging level was specified."
[level]
(if compile-time-level
(when (sufficient-level? level)
`(@ns-filter-cache *ns*))
`(and (sufficient-level? ~level) (@ns-filter-cache *ns*))))
(comment
(def compile-time-level :info)