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

33 lines
1.7 KiB
Text
Raw Normal View History

2024-04-15 07:57:40 +00:00
Call a Telemere signal creator to conditionally create a signal at that callsite.
When filtering conditions are met [4], the call creates a Telemere signal [3]
and dispatches it to registered handlers for processing (e.g. writing to
console/file/queue/db, etc.).
Telemere doesn't make a hard distinction between different kinds of signals
(log, event, error, etc.) - they're all just plain Clojure/Script maps with
various keys:
- All signal creators offer the same options [2], and
- All signal kinds can contain the same content [3]
Creators vary only in in their default options and call APIs (expected args
and return values), making them more/less convenient for certain use cases:
`event!` -------- [id ] or [id opts/level] => true iff signal was created (allowed)
`log!` ---------- [msg ] or [opts/level msg] => true iff signal was created (allowed)
`error!` -------- [error] or [opts/id error] => given error (unconditional)
`trace!` -------- [form ] or [opts/id form] => form result (value/throw) (unconditional)
`spy!` ---------- [form ] or [opts/level form] => form result (value/throw) (unconditional)
`catch->error!` - [form ] or [opts/id form] => form value, or given fallback
`signal!` ------- [opts ] => depends on options
2024-04-15 07:57:40 +00:00
- `log!` and `event!` are both good default/general-purpose signal creators.
- `log!` emphasizes messages, while `event!` emphasizes ids.
- `signal!` is the generic creator, and is used by all the others.
----------------------------------------------------------------------
2024-04-17 14:16:14 +00:00
[2] See `help:signal-options` - {:keys [kind level id data ...]}
[3] See `help:signal-content` - {:keys [kind level id data ...]}
2024-08-07 10:00:22 +00:00
[4] See `help:signal-filters` - (by ns/kind/id/level, sampling, etc.)