mirror of
https://github.com/taoensso/telemere.git
synced 2025-12-18 10:11:10 +00:00
[doc] [#17] Add example of using middleware to remove unwanted signal keys
This commit is contained in:
parent
a77021e436
commit
19d10ed789
1 changed files with 17 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
Signals are maps with {:keys [inst id ns level data msg_ ...]},
|
Signals are maps with {:keys [inst id ns level data msg_ ...]}, though they
|
||||||
though they can be modified by signal and/or handler middleware.
|
can be modified by signal and/or handler middleware (see end for examples).
|
||||||
|
|
||||||
Default signal keys:
|
Default signal keys:
|
||||||
|
|
||||||
|
|
@ -38,6 +38,21 @@ Default signal keys:
|
||||||
in handler output, so a great way to provide custom data/opts for use
|
in handler output, so a great way to provide custom data/opts for use
|
||||||
(only) by custom middleware/handlers.
|
(only) by custom middleware/handlers.
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
Middleware examples:
|
||||||
|
|
||||||
|
Remove key/s from all signals:
|
||||||
|
|
||||||
|
(t/set-middleware! (fn [signal] (dissoc signal :unwanted-key1 ...)))
|
||||||
|
|
||||||
|
Remove key/s from signals to specific handler:
|
||||||
|
|
||||||
|
(t/add-handler! ::my-handler my-handler
|
||||||
|
{:middleware (fn [signal] (dissoc signal :unwanted-key1 ...))})
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
If anything is unclear, please ping me (@ptaoussanis) so that I can improve these docs!
|
If anything is unclear, please ping me (@ptaoussanis) so that I can improve these docs!
|
||||||
|
|
||||||
[1] `java.time.Instant` or `js/Date`
|
[1] `java.time.Instant` or `js/Date`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue