         (wrap-cors)
         (wrap-connection db-uri)
         (wrap-keyword-params)
-        (wrap-params))))
+        (wrap-params)
+        (wrap-log))))

(ns lens.app
  (:use plumbing.core)
  (:require [bidi.bidi :as bidi]
            [bidi.ring :as bidi-ring]
            [io.clojure.liberator-transit]
            [ring.middleware.params :refer [wrap-params]]

      resp
      {:status 404})))

(defn wrap-log [handler]
  (fn [req]
    (let [resp (handler req)]
      (log/info (pr-str {:request (select-keys req [:remote-addr :request-method
                                                    :uri :query-string :headers])
                         :response (select-keys resp [:status :headers])}))
      resp)))

(defnk app [db-uri context-path :as opts]
  (assert (re-matches #"/(?:.*[^/])?" context-path))
  (let [routes (routes context-path)
