mirror of
https://github.com/taoensso/telemere.git
synced 2026-02-12 14:35:17 +00:00
Users caught by this change should receive a clear compile-time error.
Apologies for the nuissance!! This change is part of a final review
of names before the release of v1 final.
Motivations:
- "xfn" is a lot shorter than "middleware", making it more
convenient to use at signal calls, compare:
(log! {:middleware my-fn} "msg")
(log! {:xfn my-fn} "msg"}
- "middleware" was originally chosen to match Timbre's terminology,
but actually carries some misleading connotations that in hindsight
are probably better avoided while we still have the chance to change
this.
41 lines
2.3 KiB
Text
41 lines
2.3 KiB
Text
Signals are maps with {:keys [inst id ns level data msg_ ...]}, though they
|
|
can be modified by call and/or handler transform (xfns).
|
|
|
|
Default signal keys:
|
|
|
|
`:schema` ------ Int version of signal schema (current: 1)
|
|
`:inst` -------- Platform instant [1] when signal was created, monotonicity depends on system clock
|
|
`:level` ------- Signal level ∈ #{<int> :trace :debug :info :warn :error :fatal :report ...}
|
|
`:kind` -------- Signal ?kind ∈ #{nil :event :error :log :trace :spy :slf4j :tools-logging <app-val> ...}
|
|
`: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 when tracing, contrast with `:id`)
|
|
|
|
`:msg_` -------- Arb app-level message ?str given to signal creator - may be a delay, always use `force` to unwrap!
|
|
`:data` -------- Arb app-level data ?val (usu. a map) given to signal creator
|
|
`:error` ------- Arb app-level platform ?error [2] given to signal creator
|
|
|
|
`:run-form` ---- Unevaluated ?form given to signal creator as `:run`
|
|
`:run-val` ----- Successful return ?val of `:run` ?form
|
|
`:run-nsecs` --- ?int nanosecs runtime of `:run` ?form
|
|
`:end-inst` ---- Platform ?instant [1] when `:run` ?form completed
|
|
|
|
`:parent` ------ ?{:keys [id uid]} of parent signal, present in nested signals when tracing
|
|
`:root` -------- ?{:keys [id uid]} of root signal, present in nested signals when tracing
|
|
`:ctx` --------- ?val of `*ctx*` (arb app-level state) when signal was created
|
|
|
|
`:ns` ---------- ?str namespace of signal callsite
|
|
`:coords` ------ ?[line column] of signal callsite
|
|
|
|
`:host` -------- (Clj only) {:keys [name ip]} info for network host
|
|
`:thread` ------ (Clj only) {:keys [name id group]} info for thread that created signal
|
|
|
|
`:sample-rate` - ?rate ∈ℝ[0,1] for combined signal AND handler sampling (0.75 => allow 75% of signals, nil => allow all)
|
|
|
|
<kvs> ---------- Other arb app-level ?kvs given to signal creator. Typically NOT included
|
|
in handler output, so a great way to provide custom data/opts for use
|
|
(only) by custom transforms/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`
|