2024-03-11 08:49:56 +00:00
|
|
|
"Log" signal call, focused on message + level.
|
|
|
|
|
|
|
|
|
|
API: [msg] [level-or-opts msg] => true iff signal call was allowed.
|
|
|
|
|
Default kind: `:log`
|
|
|
|
|
Default level: `:info`
|
|
|
|
|
|
|
|
|
|
When conditions are met [1], creates a Telemere signal [2] and dispatches it to
|
|
|
|
|
registered handlers for processing (writing to console/disk/db, etc.).
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
|
|
(log! "My msg") ; %> {:kind :log, :level :info, :id ::my-id ...}
|
|
|
|
|
(log! :warn "My msg") ; %> {... :level :warn ...}
|
|
|
|
|
(log!
|
|
|
|
|
{:let [x "x"] ; Available to `:data` and `:msg`
|
|
|
|
|
:data {:x x}}
|
|
|
|
|
|
|
|
|
|
["My msg:" x]) ; %> {... :data {x "x"}, :msg_ "My msg: x" ...}
|
|
|
|
|
|
|
|
|
|
Tips:
|
|
|
|
|
|
2024-03-29 11:30:02 +00:00
|
|
|
- Test using `with-signal`: (with-signal (log! ...)).
|
2024-03-11 08:49:56 +00:00
|
|
|
- Supports the same options as other signals [3].
|
|
|
|
|
|
|
|
|
|
- Prefer `event!` to `log!` by default, since it better encourages structured
|
|
|
|
|
data over unstructured messages.
|
|
|
|
|
|
|
|
|
|
- `msg` arg may be a string, or vector of strings to join with `\space`.
|
|
|
|
|
- See also `msg-splice`, `msg-skip` utils.
|
|
|
|
|
|
|
|
|
|
----------------------------------------
|
2024-04-10 17:31:13 +00:00
|
|
|
[1] See `help:signal-flow` docstring
|
2024-03-11 08:49:56 +00:00
|
|
|
[2] See `help:signal-content` docstring
|
|
|
|
|
[3] See `help:signal-options` docstring
|