30 lines
557 B
Clojure
30 lines
557 B
Clojure
(ns auto-ap.logging
|
|
(:require [com.brunobonacci.mulog :as mu]))
|
|
|
|
|
|
(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 ))
|
|
|
|
(defn peek
|
|
([x]
|
|
(info ::peek :entity x)
|
|
x)
|
|
([y x]
|
|
(info y :entity x)
|
|
x))
|