telemere/projects/main/resources/signal-docstrings/signal-options.txt

37 lines
2.3 KiB
Text
Raw Normal View History

2024-04-12 12:57:24 +00:00
Signal options (shared by all signal creators):
2024-08-05 10:59:18 +00:00
`:inst` -------- Platform instant [1] when signal was created, ∈ #{nil :auto <[1]>}
2024-04-12 12:57:24 +00:00
`:level` ------- Signal level ∈ #{<int> :trace :debug :info :warn :error :fatal :report ...}
2024-08-05 10:59:18 +00:00
`:kind` -------- Signal ?kind ∈ #{nil :event :error :log :trace :spy <app-val> ...}
2024-04-12 12:57:24 +00:00
`:id` ---------- ?id of signal (common to all signals created at callsite, contrast with `:uid`)
`:uid` --------- ?id of signal instance (unique to each signal created at callsite, contrast with `:id`)
2024-08-05 10:59:18 +00:00
`:msg` --------- Arb app-level ?message to incl. in signal: str or vec of strs to join (with `\space`)
`:data` -------- Arb app-level ?data to incl. in signal: usu. a map
`:error` ------- Arb app-level ?error to incl. in signal: platform error [2]
2024-04-12 12:57:24 +00:00
`:run` --------- ?form to execute UNCONDITIONALLY; will incl. `:run-value` in signal
`:do` ---------- ?form to execute conditionally (iff signal allowed), before establishing `:let` ?binding
`:let` --------- ?bindings to establish conditionally (iff signal allowed), BEFORE evaluating `:data` and `:msg` (useful!)
2024-04-12 12:57:24 +00:00
`:ctx` --------- Custom ?val to override auto (dynamic `*ctx*`) in signal
`:parent` ------ Custom ?{:keys [id uid]} to override auto (dynamic) parent signal tracing info
`:root` -------- Custom ?{:keys [id uid]} to override auto (dynamic) root signal tracing info
2024-04-19 11:16:01 +00:00
`:location` ---- Custom ?{:keys [ns line column file]} to override auto signal creator callsite location
2024-04-25 07:37:55 +00:00
`:elidable?` --- Should signal be subject to compile-time elision? (Default: true)
2024-04-19 11:16:01 +00:00
`:sample-rate` - ?rate ∈ℝ[0,1] for signal sampling (0.75 => allow 75% of signals, nil => allow all)
2024-04-12 12:57:24 +00:00
`:when` -------- Arb ?form; when present, form must return truthy to allow signal
`:rate-limit` -- ?spec as given to `taoensso.telemere/rate-limiter`, see its docstring for details
`:middleware` -- Optional (fn [signal]) => ?modified-signal to apply when signal is created
2024-04-12 12:57:24 +00:00
`:trace?` ------ Should tracing be enabled for `:run` form?
2024-08-05 10:59:18 +00:00
<kvs> ---------- Other arb app-level ?kvs to incl. in signal. Typically NOT included in
2024-04-25 07:37:55 +00:00
handler output, so a great way to provide custom data/opts for use
(only) by custom middleware/handlers.
If anything is unclear, please ping me (@ptaoussanis) so that I can improve these docs!
[1] `java.time.Instant` or `js/Date`
[2] `java.lang.Throwable` or `js/Error`