Fork me on GitHub

any idea on how I can log the requests and responses I get via aleph client ? I can't seem to figure this out based on the docs. I've tried several combinations, including:

(netty/set-logger! :slf4j)

(def conn-pool (http/connection-pool {:connection-options {:log-activity :trace}
                                      :log-activity :trace}))
and using this like:

   req (merge {:method :get
                    :pool conn-pool
                    :url url} opts)
I can see my log messages but nothing from aleph http client p.s. I am willing to improve the docs for this


One simple approach is to compose functions on to the deferred response. Something like this:

(manifold.deferred/chain (http/request req) (fn [response] (log/info :response response) response))


I often convert my responses into a map of request and response in all cases to make testing and debugging easier using a similar approach.


thanks, but I might be doing something wrong, because it does not work for me


     (let [res (-> @(d/chain (http/request req)
                             (fn [response] (log/info "WHAAAA " :response response) response)))
           body (:body res)]
       (log/info "Writing statement to file" file)
       (bs/transfer body file))
I can see "Writing statement" line but nothing for the manifold chain


so it seems to work but I was looking for the logs in the wrong window


I was about to ask about log configuration and tooling. Glad to hear you've found the output. 🙂


yeah, the experience is not great (being gentle). I'll see if I can improve it somehow (docs at least)


thanks for the help 🙂

👍 1
Matthew Davidson (kingmob)07:06:22

@U011NGC5FFY doc improvements are always welcome. Maybe it belongs in examples/?

👍 1

there was some logging in the repl output window and some (from timbre) in the calva output file. that was a bit confusing. I was checking only calva output file