mirror of
https://github.com/taoensso/telemere.git
synced 2025-12-16 17:41:12 +00:00
[mod] [#56] utils/clean-signal-fn exclude :schema by default
It's probably more common for users to NOT want the `:schema` key to be included, so let's make that the default.
This commit is contained in:
parent
82f4c31651
commit
c78eb07385
2 changed files with 7 additions and 5 deletions
|
|
@ -663,7 +663,7 @@
|
|||
`:incl-nils?` - Include signal's keys with nil values? (default false)
|
||||
`:incl-kvs?` - Include signal's app-level root kvs? (default false)
|
||||
`:incl-keys` - Subset of signal keys to retain from those otherwise
|
||||
excluded by default: #{:kvs :host :thread}"
|
||||
excluded by default: #{:schema :kvs :host :thread}"
|
||||
([] (clean-signal-fn nil))
|
||||
([{:keys [incl-kvs? incl-nils? incl-keys] :as opts}]
|
||||
(let [assoc!*
|
||||
|
|
@ -671,6 +671,7 @@
|
|||
(fn [m k v] (if (nil? v) m (assoc! m k v))) ; As `remove-signal-nils`
|
||||
(do assoc!))
|
||||
|
||||
incl-schema? (contains? incl-keys :schema)
|
||||
incl-kvs-key? (contains? incl-keys :kvs)
|
||||
incl-host? (contains? incl-keys :host)
|
||||
incl-thread? (contains? incl-keys :thread)]
|
||||
|
|
@ -685,7 +686,7 @@
|
|||
(clojure.core/into ()
|
||||
(clojure.core/disj
|
||||
taoensso.telemere.impl/standard-signal-keys
|
||||
:msg_ :error :kvs :host :thread))
|
||||
:msg_ :error :schema :kvs :host :thread))
|
||||
(assoc!* m k v)
|
||||
|
||||
;; Main keys to include with modified val
|
||||
|
|
@ -697,6 +698,7 @@
|
|||
taoensso.telemere.impl/impl-signal-keys) m ; noop
|
||||
|
||||
;;; Other keys to exclude by default
|
||||
:schema (if incl-schema? (assoc!* m k v) m)
|
||||
:kvs (if incl-kvs-key? (assoc!* m k v) m)
|
||||
:thread (if incl-thread? (assoc!* m k v) m)
|
||||
:host (if incl-host? (assoc!* m k v) m)
|
||||
|
|
|
|||
|
|
@ -855,7 +855,7 @@
|
|||
[(is (= sig*1 sig*2) "Default :pr-fn is :edn")
|
||||
(is
|
||||
(sm? sig*1
|
||||
{:schema 1, :kind :event, :id ::ev-id, :level :info,
|
||||
{:kind :event, :id ::ev-id, :level :info,
|
||||
:ns "taoensso.telemere-tests"
|
||||
:msg_ "a b"
|
||||
:inst udt1
|
||||
|
|
@ -866,8 +866,8 @@
|
|||
(let [sig* (enc/read-json ((tel/pr-signal-fn {:pr-fn :json}) sig))]
|
||||
(is
|
||||
(sm? sig*
|
||||
{"schema" 1, "kind" "event", "id" "taoensso.telemere-tests/ev-id",
|
||||
"level" "info", "ns" "taoensso.telemere-tests"
|
||||
{"kind" "event", "id" "taoensso.telemere-tests/ev-id",
|
||||
"level" "info", "ns" "taoensso.telemere-tests"
|
||||
"msg_" "a b"
|
||||
"inst" t1s
|
||||
"coords" vector?})))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue