36 lines
812 B
Clojure
36 lines
812 B
Clojure
(ns auto-ap.logging
|
|
(:require [clojure.tools.logging :as log]
|
|
[unilog.context :as lc]
|
|
[com.brunobonacci.mulog :as mu]))
|
|
|
|
(defn info-event [message context]
|
|
(lc/with-context context
|
|
(log/info message)))
|
|
|
|
(defn warn-event [message context]
|
|
(lc/with-context context
|
|
(log/warn message)))
|
|
|
|
|
|
(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 ))
|