Experimental, subject to change. Minimal Telemere shell API for library authors, etc. Allows library code to use Telemere if it's present, or fall back to something like tools.logging otherwise.
(if-telemere then)(if-telemere then else)Evaluates to `then` form if Telemere is present when expanding macro. Otherwise expands to `else` form.
(require-telemere-if-present)Experimental, subject to change. Requires Telemere if it's present, otherwise noops. Used in cooperation with `signal!`, etc. For Cljs: - MUST be placed at top of file, just below `ns` form - Needs ClojureScript >= v1.9.293 (Oct 2016)
(set-min-level! min-level)(set-min-level! kind min-level)(set-min-level! kind ns-filter min-level)Expands to `taoensso.telemere/set-min-level!` call iff Telemere is present. Otherwise expands to `nil` (noops).
(signal! {:as opts
:keys [fallback elidable? location inst uid middleware sample-rate
kind ns id level when rate-limit rate-limit-by ctx parent root
trace? do let data msg error run & kvs]})Experimental, subject to change.
Telemere shell API for library authors, etc.
Expands to `taoensso.telemere/signal!` call if Telemere is present.
Otherwise expands to arbitrary `fallback` opt form.
Allows library code to use Telemere if it's present, or fall back to
something like tools.logging otherwise.
MUST be used with `require-telemere-if-present`, example:
(ns my-lib
(:require
[taoensso.telemere.shell :as t] ; `com.taoensso/telemere-shell` dependency
[clojure.tools.logging :as ctl] ; `org.clojure/tools.logging` dependency
))
(t/require-telemere-if-present) ; Just below `ns` form!
(t/signal!
{:kind :log, :id :my-id, :level :warn,
:let [x :x]
:msg ["Hello" "world" x]
:data {:a :A :x x}
:fallback (ctl/warn (str "Hello world" x))})
For more info, see:
- Telemere `signal!`, Ref. <https://www.taoensso.com/telemere/signal!>
- Telemere docs, Ref. <https://www.taoensso.com/telemere>(signal-allowed? {:as opts
:keys [elidable? location sample-rate kind ns id level when
rate-limit rate-limit-by]})Experimental, subject to change.
Returns true iff Telemere is present and signal with given opts would meet
filtering conditions.
MUST be used with `require-telemere-if-present`, example:
(ns my-lib (:require [taoensso.telemere.shell :as t]))
(t/require-telemere-if-present) ; Just below `ns` form!
(when (t/signal-allowed? {:level :warn, <...>})
(my-custom-code))cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |