From 7f16a79af5bb104b24b636e5c50ff870d251f1e2 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 26 Jun 2023 11:16:37 +0200 Subject: [PATCH] :bug: Fix email printing to the logging subsystem Fixes #3239 --- backend/src/app/email.clj | 2 +- common/src/app/common/logging.cljc | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/src/app/email.clj b/backend/src/app/email.clj index 4df427388..5d85c5f71 100644 --- a/backend/src/app/email.clj +++ b/backend/src/app/email.clj @@ -341,7 +341,7 @@ (map :content) first))) (println "******** end email" (:id email) "**********"))] - (l/info ::l/raw out))) + (l/raw! :info out))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; EMAIL FACTORIES diff --git a/common/src/app/common/logging.cljc b/common/src/app/common/logging.cljc index b1aff50c2..0402343b9 100644 --- a/common/src/app/common/logging.cljc +++ b/common/src/app/common/logging.cljc @@ -239,7 +239,7 @@ #?(:clj (defn slf4j-log-handler {:no-doc true} - [_ _ _ {:keys [::logger ::level ::props ::cause ::trace ::message]}] + [_ _ _ {:keys [::logger ::level ::trace ::message] }] (when-let [logger (enabled? logger level)] (let [message (cond-> @message (some? trace) @@ -307,6 +307,18 @@ (l/set-level! logger level))) config))) +(defmacro raw! + [level message] + (let [cljs? (:ns &env)] + `(do + (~(if cljs? + `(partial console-log-handler nil nil nil) + `(partial slf4j-log-handler nil nil nil)) + {::logger ~(str *ns*) + ::level ~level + ::message (delay ~message)}) + nil))) + (defmacro info [& params] `(do