aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Faulhaber <git_net@infolace.com>2009-08-07 23:41:43 -0700
committerTom Faulhaber <git_net@infolace.com>2009-08-07 23:41:43 -0700
commit90f7ea1dec4e7c835cf3a7f98e67c4e02d7d0f64 (patch)
tree52d9a816a16ae5be23f20eb3508ba5888ad85507
parent6dd2205627cd524894b1175da20ce9c5ac65aef7 (diff)
Fixes #11; log-ns is now captured at macro-expansion-time.
-rw-r--r--src/clojure/contrib/logging.clj10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/clojure/contrib/logging.clj b/src/clojure/contrib/logging.clj
index ef49d1a8..7432b34b 100644
--- a/src/clojure/contrib/logging.clj
+++ b/src/clojure/contrib/logging.clj
@@ -178,7 +178,7 @@
([level message]
`(log ~level ~message nil))
([level message throwable]
- `(log ~level ~message ~throwable (str *ns*)))
+ `(log ~level ~message ~throwable ~(str *ns*)))
([level message throwable log-ns]
`(if (and @*allow-direct-logging*
(not (clojure.lang.LockingTransaction/isRunning)))
@@ -187,15 +187,15 @@
do-log ~level (delay ~message) ~throwable ~log-ns))))
-(defn enabled?
+(defmacro enabled?
"Returns true if the specific logging level is enabled. Use of this function
should only be necessary if one needs to execute alternate code paths beyond
whether the log should be written to."
([level]
- (enabled? level (str *ns*)))
+ `(enabled? ~level ~(str *ns*)))
([level log-ns]
- (let [sys @*log-system*]
- ((sys :enabled?) ((sys :get-log) log-ns) level))))
+ `(let [sys# @*log-system*]
+ ((sys# :enabled?) ((sys# :get-log) ~log-ns) ~level))))
(defmacro spy