mirror of https://github.com/status-im/timbre.git
[#199] More reliable fix for unintended warning output to cljs
This commit is contained in:
parent
44499d02e9
commit
b5c998b46b
|
@ -186,13 +186,18 @@
|
||||||
|
|
||||||
;;;; Combo filtering
|
;;;; Combo filtering
|
||||||
|
|
||||||
|
#+clj
|
||||||
|
(defn- compiling-cljs? []
|
||||||
|
(when-let [n (find-ns 'cljs.analyzer)]
|
||||||
|
(when-let [v (ns-resolve n '*cljs-file*)]
|
||||||
|
@v)))
|
||||||
|
|
||||||
#+clj
|
#+clj
|
||||||
(def ^:private compile-time-level
|
(def ^:private compile-time-level
|
||||||
(when-let [level (or (enc/read-sys-val "TIMBRE_LEVEL")
|
(when-let [level (or (enc/read-sys-val "TIMBRE_LEVEL")
|
||||||
(enc/read-sys-val "TIMBRE_LOG_LEVEL"))]
|
(enc/read-sys-val "TIMBRE_LOG_LEVEL"))]
|
||||||
(enc/if-clj
|
(when-not (compiling-cljs?)
|
||||||
(println (str "Compile-time (elision) Timbre level: " level))
|
(println (str "Compile-time (elision) Timbre level: " level)))
|
||||||
nil)
|
|
||||||
|
|
||||||
(let [;; Back compatibility
|
(let [;; Back compatibility
|
||||||
level (if (string? level) (keyword level) level)]
|
level (if (string? level) (keyword level) level)]
|
||||||
|
@ -202,16 +207,21 @@
|
||||||
(def ^:private compile-time-ns-filter
|
(def ^:private compile-time-ns-filter
|
||||||
(if-let [ns-pattern (enc/read-sys-val "TIMBRE_NS_PATTERN")]
|
(if-let [ns-pattern (enc/read-sys-val "TIMBRE_NS_PATTERN")]
|
||||||
(do
|
(do
|
||||||
(enc/if-clj
|
(when-not (compiling-cljs?)
|
||||||
(println (str "Compile-time (elision) Timbre ns-pattern: " ns-pattern))
|
(println (str "Compile-time (elision) Timbre ns-pattern: " ns-pattern)))
|
||||||
nil)
|
|
||||||
(-compile-ns-filter ns-pattern))
|
(-compile-ns-filter ns-pattern))
|
||||||
|
|
||||||
;; Back compatibility
|
;; Back compatibility
|
||||||
(let [whitelist (have [:or nil? vector?] (enc/read-sys-val "TIMBRE_NS_WHITELIST"))
|
(let [whitelist (have [:or nil? vector?] (enc/read-sys-val "TIMBRE_NS_WHITELIST"))
|
||||||
blacklist (have [:or nil? vector?] (enc/read-sys-val "TIMBRE_NS_BLACKLIST"))]
|
blacklist (have [:or nil? vector?] (enc/read-sys-val "TIMBRE_NS_BLACKLIST"))]
|
||||||
(when whitelist (println (str "Compile-time (elision) Timbre ns whitelist: " whitelist)))
|
|
||||||
(when blacklist (println (str "Compile-time (elision) Timbre ns blacklist: " blacklist)))
|
(when (and whitelist (not (compiling-cljs?)))
|
||||||
|
(println (str "Compile-time (elision) Timbre ns whitelist: " whitelist)))
|
||||||
|
|
||||||
|
(when (and blacklist (not (compiling-cljs?)))
|
||||||
|
(println (str "Compile-time (elision) Timbre ns blacklist: " blacklist)))
|
||||||
|
|
||||||
(-compile-ns-filter whitelist blacklist))))
|
(-compile-ns-filter whitelist blacklist))))
|
||||||
|
|
||||||
#+clj ; Called only at macro-expansiom time
|
#+clj ; Called only at macro-expansiom time
|
||||||
|
|
Loading…
Reference in New Issue