From 37b7a66b3f114060ac297ee78b158d8065e17fb1 Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Fri, 6 Dec 2024 09:32:34 +0100 Subject: [PATCH] [wip] Add temporary timbre->telemere appender --- .../main/src/taoensso/telemere/timbre.cljc | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/projects/main/src/taoensso/telemere/timbre.cljc b/projects/main/src/taoensso/telemere/timbre.cljc index 1de9df4..f7218ef 100644 --- a/projects/main/src/taoensso/telemere/timbre.cljc +++ b/projects/main/src/taoensso/telemere/timbre.cljc @@ -161,3 +161,32 @@ (defn shutdown-appenders! "Prefer `telemere/stop-handlers!`." [] (tel/stop-handlers!)) + +;;;; @TODO To wiki + +(comment + (defn timbre->telemere-appender + "Returns a simple Timbre appender that'll redirect logs to Telemere." + [] + {:enabled? true + :min-level nil + :fn + (fn [data] + (let [{:keys [instant level context ?err output_ + ?ns-str ?file ?line ?column]} data] + + (taoensso.telemere/signal! + {:kind :log + :via-timbre? true ; User-level kv to help identify these signals + + :level level + :inst (taoensso.encore/as-?inst instant) + :ctx+ context + + :ns ?ns-str + :file ?file + :line ?line + :column ?column + + :error ?err + :msg (force output_)})))}))