Fix #77: compile-time rather than runtime profile namespaced ids

This commit is contained in:
Peter Taoussanis 2014-08-14 17:32:21 +07:00
parent c9b9b4a809
commit ee49e44a46
2 changed files with 7 additions and 4 deletions

View File

@ -406,6 +406,9 @@
}))
nil))
(defmacro get-compile-time-ns [] (str *ns*)) ; Nb need `str` to be readable
(comment (macroexpand '(get-compile-time-ns)))
(defmacro log* "Implementation detail."
{:arglists '([base-appender-args msg-type level & log-args]
[base-appender-args msg-type config level & log-args])}
@ -423,7 +426,7 @@
default-config?# (levels-scored s1#)
config# (if default-config?# (get-default-config) s1#)
level# (if default-config?# s1# ~s2)
compile-time-ns# ~(str *ns*)]
compile-time-ns# (get-compile-time-ns)]
;; (println "DEBUG: Runtime level check")
(when (and (level-sufficient? level# config#)
(ns-unfiltered? config# compile-time-ns#))

View File

@ -9,7 +9,7 @@
(defmacro fq-keyword "Returns namespaced keyword for given id."
[id]
`(if (and (keyword? ~id) (namespace ~id)) ~id
(keyword (str *ns*) (name ~id))))
(keyword (timbre/get-compile-time-ns) (name ~id))))
(comment (map #(fq-keyword %) ["foo" :foo :foo/bar]))
@ -56,7 +56,7 @@
(declare ^:private format-stats)
(defmacro with-pdata [level & body]
`(if-not (timbre/logging-enabled? ~level ~(str *ns*))
`(if-not (timbre/logging-enabled? ~level (timbre/get-compile-time-ns))
{:result (do ~@body)}
(binding [*pdata* (atom {})]
{:result (pspy ::clock-time ~@body)