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 replis there a more idiomatic way for inspecting stuff in pedestal?
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...
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!
@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)
I’ll try that, thanks guys!