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.
(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)))
Comments top
No comments for with-logs. Log in to add a comment.