mirror of
https://github.com/taoensso/telemere.git
synced 2026-01-27 08:40:35 +00:00
[fix] Signal fields: define based on target (not macro) platform
Attempted fix for possible issue with "Electric Clojure"
This commit is contained in:
parent
f52a04b4dc
commit
92a7aee530
1 changed files with 21 additions and 8 deletions
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(:require-macros
|
(:require-macros
|
||||||
[taoensso.telemere.impl :refer [with-signal]])))
|
[taoensso.telemere.impl :refer [with-signal def-signal-record]])))
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(remove-ns 'taoensso.telemere.impl)
|
(remove-ns 'taoensso.telemere.impl)
|
||||||
|
|
@ -231,14 +231,27 @@
|
||||||
|
|
||||||
;;;; Main types
|
;;;; Main types
|
||||||
|
|
||||||
(defrecord Signal
|
#?(:clj
|
||||||
;; Telemere's main public data type, we avoid nesting and duplication
|
(defmacro def-signal-record
|
||||||
[^long schema inst uid,
|
"Defines Telemere's main public data type, we avoid nesting and duplication."
|
||||||
location ns line column file, #?@(:clj [host thread _otel-context]),
|
[]
|
||||||
sample-rate, kind id level, ctx parent root, data kvs msg_,
|
(let [fields
|
||||||
error run-form run-val end-inst run-nsecs]
|
(if (:ns &env)
|
||||||
|
'[schema inst uid,
|
||||||
|
location ns line column file,
|
||||||
|
;; host thread _otel-context,
|
||||||
|
sample-rate, kind id level, ctx parent root, data kvs msg_,
|
||||||
|
error run-form run-val end-inst run-nsecs]
|
||||||
|
'[schema inst uid,
|
||||||
|
location ns line column file,
|
||||||
|
host thread _otel-context,
|
||||||
|
sample-rate, kind id level, ctx parent root, data kvs msg_,
|
||||||
|
error run-form run-val end-inst run-nsecs])]
|
||||||
|
|
||||||
Object (toString [sig] (str "#" `Signal (into {} sig))))
|
`(defrecord ~'Signal ~fields
|
||||||
|
~'Object (~'toString [sig#] (str "#taoensso.telemere.impl.Signal" (into {} sig#)))))))
|
||||||
|
|
||||||
|
(defonce __def-signal-record (def-signal-record))
|
||||||
|
|
||||||
(do (enc/def-print-impl [sig Signal] (str "#" `Signal (pr-str (into {} sig)))))
|
(do (enc/def-print-impl [sig Signal] (str "#" `Signal (pr-str (into {} sig)))))
|
||||||
#?(:clj (enc/def-print-dup [sig Signal] (str "#" `Signal (pr-str (into {} sig))))) ; NB intentionally verbose, to support extra keys
|
#?(:clj (enc/def-print-dup [sig Signal] (str "#" `Signal (pr-str (into {} sig))))) ; NB intentionally verbose, to support extra keys
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue