revamped logging!
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
[com.walmartlabs.lacinia.resolve :as resolve]
|
||||
[buddy.auth :refer [throw-unauthorized]]
|
||||
[auto-ap.utils :refer [by]]
|
||||
[auto-ap.logging :refer [info-event warn-event error-event]]
|
||||
[auto-ap.graphql.utils :refer [assert-admin can-see-client? assert-can-see-client]]
|
||||
[auto-ap.datomic :refer [uri merge-query]]
|
||||
[datomic.api :as d]
|
||||
@@ -29,7 +30,10 @@
|
||||
[auto-ap.graphql.transaction-rules :as gq-transaction-rules]
|
||||
[auto-ap.time :as time]
|
||||
[clojure.walk :as walk]
|
||||
[clojure.string :as str])
|
||||
[clojure.string :as str]
|
||||
[clojure.tools.logging :as log]
|
||||
[yang.time :refer [time-it]]
|
||||
[unilog.context :as lc])
|
||||
(:import
|
||||
(clojure.lang IPersistentMap)))
|
||||
|
||||
@@ -945,7 +949,6 @@
|
||||
(filter (fn [[potential-id potential-date]]
|
||||
(let [date (coerce/to-date-time date)
|
||||
potential-date (coerce/to-date-time potential-date)]
|
||||
#_(println "HERE" id potential-id potential-date date)
|
||||
(and (= id potential-id)
|
||||
(<= (t/in-days (apply t/interval (sort [date potential-date]))) 10)))))
|
||||
conj
|
||||
@@ -1010,7 +1013,6 @@
|
||||
:amount amount
|
||||
:date (coerce/to-date-time next)})
|
||||
is-week-a? (fn [d]
|
||||
(println d)
|
||||
(= 0 (mod (t/in-weeks (t/interval first-week-a d)) 2)))]
|
||||
|
||||
{:beginning_balance total-cash
|
||||
@@ -1110,20 +1112,24 @@
|
||||
([id q]
|
||||
(query id q nil ))
|
||||
([id q v]
|
||||
(println "executing graphql query" id q v)
|
||||
(try
|
||||
(let [result (time (simplify (execute schema q v {:id id})))]
|
||||
(when (seq (:errors result))
|
||||
(throw (ex-info "GraphQL error" {:result result})))
|
||||
result)
|
||||
|
||||
(lc/with-context {:query q}
|
||||
(log/info "Executing query" q)
|
||||
|
||||
(try
|
||||
(let [[result time] (time-it (simplify (execute schema q v {:id id})))]
|
||||
|
||||
(info-event "Query completed"
|
||||
{:time (:time time)
|
||||
:errors (seq (:errors result))})
|
||||
(when (seq (:errors result))
|
||||
(throw (ex-info "GraphQL error" {:result result})))
|
||||
result)
|
||||
|
||||
(catch Exception e
|
||||
(if-let [v (:validation-error (ex-data e))]
|
||||
(println "validation error" v)
|
||||
(do
|
||||
(.printStackTrace e)
|
||||
(println e )))
|
||||
(catch Exception e
|
||||
(if-let [v (:validation-error (ex-data e))]
|
||||
(warn-event "validation error" {:validation-error v
|
||||
:data (ex-data e)})
|
||||
(error-event "query error" {:error e}))
|
||||
|
||||
(throw e)))))
|
||||
|
||||
#_(query nil "{ ledger_page { count }}" nil)
|
||||
(throw e))))))
|
||||
|
||||
Reference in New Issue
Block a user