fixes sales queries, minor logging tweaks

This commit is contained in:
Bryce Covert
2023-01-06 17:37:01 -08:00
parent 7c0004d7bd
commit 0c08e6a929
4 changed files with 74 additions and 58 deletions

View File

@@ -1,6 +1,8 @@
(ns auto-ap.logging
(:require [clojure.tools.logging :as log]
[unilog.context :as lc]))
[unilog.context :as lc]
[com.brunobonacci.mulog :as mu]))
(defn info-event [message context]
(lc/with-context context
(log/info message)))
@@ -13,3 +15,21 @@
(defn error-event [message context]
(lc/with-context context
(log/warn message)))
(defmacro with-context-as [ctx s & body]
`(mu/with-context ~ctx
(let [~s (mu/local-context)]
~@body)))
(defmacro capture-context->lc [& body]
`(let [~'lc (mu/local-context)]
~@body))
(defmacro info [x & kvs]
`(mu/log ~x :status "INFO" ~@kvs ))
(defmacro warn [x & kvs]
`(mu/log ~x :status "WARN" ~@kvs ))
(defmacro error [x & kvs]
`(mu/log ~x :status "ERROR" ~@kvs ))