pedestal

yiorgos 2020-03-24T15:31:31.049600Z

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

yiorgos 2020-03-24T15:32:00.050300Z

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

orestis 2020-03-24T16:21:42.052Z

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...

orestis 2020-03-24T16:22:54.053Z

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

2020-03-24T16:42:00.055800Z

@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)

yiorgos 2020-03-24T18:10:03.056500Z

I’ll try that, thanks guys!

👍 1