如何通过clojure.tools.logging记录哪个是像pprint这样的Pretty print?

How to log which is the Pretty print like pprint by clojure.tools.logging?

我正在使用 org.clojure/tools.logging。 我想获得一个可以漂亮地打印日志的功能,但我找不到它。 比如我要打印的内容是

{:status 401,
 :headers {"Content-Type" "application/octet-stream"},
 :body {:error "You don't login."}}

但我称函数名称为 info,我明白了

{:status 401, :headers {Content-Type application/octet-stream}, :body {:error You don't login.}}

这样的事情怎么样:

(require '[clojure.pprint :as pprint])

(defn pformat [& args]
        (with-out-str
          (apply pprint/pprint args)))

然后:

(require '[clojure.tools.logging :as log])

(log/info (pformat {:status 401,
                    :headers {"Content-Type" "application/octet-stream"},
                    :body {:error "You don't login."}}))

输出如下:

Apr 29, 2015 9:43:40 AM user invoke
INFO: {:headers {"Content-Type" "application/octet-stream"},
 :status 401,
 :body {:error "You don't login."}}