Fork me on GitHub
#pedestal
<
2020-03-24
>
yiorgos15:03:31

Hi guys, I started learning Pedestal and I would like to log the incoming request in the interceptor I have a function

(defn home [request]
  (io.pedestal.log/debug "------->" request)
  {:status 200
   :headers {"Content-Type" "text/html"}
   :body   (selmer/render-file "home.html" {})})
but nothing is getting printed in the repl

yiorgos15:03:00

is there a more idiomatic way for inspecting stuff in pedestal?

orestis16:03:42

I’m pretty sure that call to log is wrong, but I’m on mobile and can’t check. But if you want to inspect things, I’d use the repl, def the request to a global var and go from there...

orestis16:03:54

https://www.google.dk/search?q=clojure+debugging+with+def&amp;ie=UTF-8&amp;oe=UTF-8&amp;hl=el-dk&amp;client=safari - sorry for pasting a google link, but I’m in a hurry - there’s some good stuff out there!

ddeaguiar16:03:00

@g3o, If you are using default-interceptors, there’s a default request logging interceptor but it can be overridden by adding the io.pedestal.http/request-logger key to your service map. (See http://pedestal.io/reference/default-interceptors) @orestis is correct about the logging call being incorrect. Pedestal’s logging api expects key/value pairs so you’d do something like this (log/debug :request request)

yiorgos18:03:03

I’ll try that, thanks guys!

👍 4