How to log which is the Pretty print like pprint by clojure.tools.logging? -
i using org.clojure/tools.logging
. want function can pretty print log, can't find it. example, content want print is
{:status 401, :headers {"content-type" "application/octet-stream"}, :body {:error "you don't login."}}
but call function name info
,i this
{:status 401, :headers {content-type application/octet-stream}, :body {:error don't login.}}
how this:
(require '[clojure.pprint :as pprint]) (defn pformat [& args] (with-out-str (apply pprint/pprint args)))
then:
(require '[clojure.tools.logging :as log]) (log/info (pformat {:status 401, :headers {"content-type" "application/octet-stream"}, :body {:error "you don't login."}}))
which outputs this:
apr 29, 2015 9:43:40 user invoke info: {:headers {"content-type" "application/octet-stream"}, :status 401, :body {:error "you don't login."}}
Comments
Post a Comment