Fork me on GitHub
#funcool
<
2015-11-02
>
niwinz14:11:03

@mitchelkuijpers: at this moment is not posibile do it directly in catacumba but I think you can use java interop just for that:

(import 'ratpack.handling.RequestLogger)
(def routes (ct/routes [[:any (RequestLogger/ncsa)]]))

niwinz14:11:20

Sorry for my late response, i was so busy that days

mitchelkuijpers14:11:22

I already fixed it

mitchelkuijpers14:11:37

that was literally what I did 😛

mitchelkuijpers14:11:11

(defn- log-request [^RequestOutcome outcome]
  (let [request ^Request (.getRequest outcome)
        duration ^Duration (.getDuration outcome)
        response ^SentResponse (.getResponse outcome)
        status ^Status (.getStatus response)]
    (log/info (format "%sms \"%s %s %s\" %s"
                      (.toMillis duration)
                      (.getMethod request)
                      (.getUri request)
                      (.getProtocol request)
                      (.getCode status)))))

mitchelkuijpers14:11:16

I wanted other information though

niwinz14:11:45

Nice! I think that would be awesome have something like that in catacumba in a more clojure friendly way..

niwinz14:11:50

I open an issue for it 😉

mitchelkuijpers14:11:56

One thing I noticed that if I use this with the component based approach it seems to be related to the order if the the logger get’s called for routes

niwinz14:11:12

Thanks you for notice me about that!

mitchelkuijpers14:11:01

We are running in production now for a few weeks already, works like charm. combining the handlers with cats and manifold deferreds is seriously powerfull

niwinz14:11:03

Nice to know that!

niwinz14:11:20

I did't know that you are using cats

niwinz14:11:34

tell me more about your experience!!

niwinz14:11:29

Maybe you can write a blog post about that! 😛

mitchelkuijpers15:11:55

I will do that sir