revamped logging!

This commit is contained in:
Bryce Covert
2020-08-01 17:07:17 -07:00
parent 49f98522c0
commit 51b097766f
33 changed files with 598 additions and 485 deletions

View File

@@ -9,24 +9,27 @@
[clj-time.predicates :as pred]
[clojure.data.json :as json]
[compojure.core :refer [GET PUT POST context defroutes
wrap-routes]])
wrap-routes]]
[clojure.tools.logging :as log]
[unilog.context :as lc])
(:import (org.joda.time DateTime)))
(defroutes routes
(context "/events" []
(POST "/yodlee-import" {:keys [query-params headers body] :as x}
(let [notification-type (get headers "x-amz-sns-message-type")]
(println "Received notification " notification-type)
(if (= "SubscriptionConfirmation" notification-type)
(do
(println "Responding to confirmation" )
(let [json (json/read-str (slurp body))]
(println json)
(http/get (get json "SubscribeURL"))))
(do
(println "importing from yodlee")
(yodlee-import/do-import))))
(lc/with-context {:source "Import yodlee transactions"}
(let [notification-type (get headers "x-amz-sns-message-type")]
(log/info "Received notification " notification-type)
(if (= "SubscriptionConfirmation" notification-type)
(do
(log/info "Responding to confirmation" )
(let [json (json/read-str (slurp body))]
(log/info json)
(http/get (get json "SubscribeURL"))))
(do
(log/info "importing from yodlee")
(yodlee-import/do-import)))))
{:status 200
:body "{}"