mirror of
https://github.com/taoensso/telemere.git
synced 2025-12-16 17:41:12 +00:00
[mod] Remove "- " msg separator from default preamble output
Better to make this optional through the new `:format-msg-fn` option available for `signal-preamble-fn`
This commit is contained in:
parent
0822217480
commit
d61f6c25e3
2 changed files with 4 additions and 4 deletions
|
|
@ -508,7 +508,7 @@
|
|||
Returns a (fn preamble [signal]) that:
|
||||
- Takes a Telemere signal (map).
|
||||
- Returns a signal preamble ?string like:
|
||||
\"2024-03-26T11:14:51.806Z INFO EVENT Hostname taoensso.telemere(2,21) ::ev-id - msg\"
|
||||
\"2024-03-26T11:14:51.806Z INFO EVENT Hostname taoensso.telemere(2,21) ::ev-id msg\"
|
||||
|
||||
Options:
|
||||
`:format-inst-fn` - (fn format [instant]) => string.
|
||||
|
|
@ -518,7 +518,7 @@
|
|||
([{:keys [format-inst-fn format-id-fn format-msg-fn]
|
||||
:or {format-inst-fn (format-inst-fn)
|
||||
format-id-fn format-id
|
||||
format-msg-fn (fn [msg] (str "- " msg))}}]
|
||||
format-msg-fn identity}}]
|
||||
|
||||
(fn signal-preamble [signal]
|
||||
(let [{:keys [inst level kind ns id msg_]} signal
|
||||
|
|
|
|||
|
|
@ -852,7 +852,7 @@
|
|||
(let [sig (with-sig :raw :trap (tel/event! ::ev-id {:inst t1, :msg ["a" "b"]}))
|
||||
preamble ((utils/signal-preamble-fn) sig)] ; "2024-06-09T21:15:20.170Z INFO EVENT taoensso.telemere-tests(592,35) ::ev-id"
|
||||
[(is (enc/str-starts-with? preamble "2024-01-01T01:01:01.110Z INFO EVENT"))
|
||||
(is (enc/str-ends-with? preamble "::ev-id - a b"))
|
||||
(is (enc/str-ends-with? preamble "::ev-id a b"))
|
||||
(is (string? (re-find #"taoensso.telemere-tests\(\d+,\d+\)" preamble)))]))
|
||||
|
||||
(testing "pr-signal-fn"
|
||||
|
|
@ -891,7 +891,7 @@
|
|||
(testing "format-signal-fn"
|
||||
(let [sig (with-sig :raw :trap (tel/event! ::ev-id {:inst t1, :msg ["a" "b"]}))]
|
||||
[(is (enc/str-starts-with? ((tel/format-signal-fn) sig ) "2024-01-01T01:01:01.110Z INFO EVENT"))
|
||||
(is (enc/str-ends-with? ((tel/format-signal-fn) (dissoc sig :host)) "::ev-id - a b\n"))]))])])
|
||||
(is (enc/str-ends-with? ((tel/format-signal-fn) (dissoc sig :host)) "::ev-id a b\n"))]))])])
|
||||
|
||||
;;;; File handler
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue