1.2.0 permalink Arrow_down_16x16
  • (with-logs log-ns & body)
Evaluates exprs in a context in which *out* and *err* are bound to :info and
:error logging, respectively. The specified log-ns value will be used to
namespace all redirected logging.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/logging.clj:291 top

(defmacro with-logs
  "Evaluates exprs in a context in which *out* and *err* are bound to :info and
  :error logging, respectively. The specified log-ns value will be used to
  namespace all redirected logging."
  [log-ns & body]
  (if (and log-ns (seq body))
    `(binding [*out* (java.io.OutputStreamWriter.
                       (log-stream :info ~log-ns))
               *err* (java.io.OutputStreamWriter.
                       (log-stream :error ~log-ns))]
      ~@body)))
Vars in clojure.contrib.logging/with-logs: and defmacro seq *err* *out* apply binding concat list vector
Used in 0 other vars

Comments top

No comments for with-logs. Log in to add a comment.