Housekeeping

This commit is contained in:
Peter Taoussanis 2012-08-02 14:59:58 +07:00
parent 6596919615
commit edf2a13817
2 changed files with 8 additions and 14 deletions

View File

@ -6,15 +6,9 @@
[clj-stacktrace "0.2.4"]]
:profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.0-master-SNAPSHOT"]]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.0-alpha3"]]}
:dev {:dependencies []}
:test {:dependencies []}}
:repositories {"sonatype" {:url "http://oss.sonatype.org/content/repositories/releases"
:snapshots false
:releases {:checksum :fail :update :always}}
"sonatype-snapshots" {:url "http://oss.sonatype.org/content/repositories/snapshots"
:snapshots true
:releases {:checksum :fail :update :always}}}
:aliases {"test-all" ["with-profile" "test,1.3:test,1.4:test,1.5" "test"]}
:min-lein-version "2.0.0"
:warn-on-reflection true)

View File

@ -44,7 +44,7 @@
:timestamp-pattern "yyyy-MMM-dd HH:mm:ss ZZ" ; SimpleDateFormat pattern
:timestamp-locale nil ; A Locale object, or nil
;;; Control :prefix format
;; Control :prefix format
:prefix-fn
(fn [{:keys [level timestamp hostname ns]}]
(str timestamp " " hostname " " (-> level name str/upper-case)
@ -233,10 +233,10 @@
(defmacro log*
"Prepares given arguments for, and then dispatches to all relevant
appender-fns."
[level base-args & args]
[level base-args & sigs]
(assert-valid-level level)
`(when-let [juxt-fn# (@appenders-juxt-cache ~level)] ; Any relevant appenders?
(let [[x1# & xs#] (list ~@args)
(let [[x1# & xs#] (list ~@sigs)
has-throwable?# (instance? Throwable x1#)
appender-args#
@ -259,10 +259,10 @@
"When logging is enabled, actually logs given arguments with relevant
appender-fns. Generic form of standard level-loggers (trace, info, etc.)."
{:arglists '([level message & more] [level throwable message & more])}
[level & args]
[level & sigs]
(assert-valid-level level)
`(when (logging-enabled? ~level)
(log* ~level {} ~@args)))
(log* ~level {} ~@sigs)))
(defmacro spy
"Evaluates expression and logs its form and result. Always returns the result.
@ -281,8 +281,8 @@
`(defmacro ~(symbol level-name)
~(str "Log given arguments at " (str/capitalize level-name) " level.")
~'{:arglists '([message & more] [throwable message & more])}
[& args#]
`(log ~~level ~@args#))))
[& sigs#]
`(log ~~level ~@sigs#))))
(defmacro ^:private def-loggers
[] `(do ~@(map (fn [level] `(def-logger ~level)) ordered-levels)))