mirror of
https://github.com/taoensso/telemere.git
synced 2026-02-22 10:09:10 +00:00
[fix] Signal fields: define same fields regardless of platform
Attempted fix for possible issue with "Electric Clojure"
This commit is contained in:
parent
92a7aee530
commit
9b24b54215
1 changed files with 11 additions and 24 deletions
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(:require-macros
|
(:require-macros
|
||||||
[taoensso.telemere.impl :refer [with-signal def-signal-record]])))
|
[taoensso.telemere.impl :refer [with-signal]])))
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(remove-ns 'taoensso.telemere.impl)
|
(remove-ns 'taoensso.telemere.impl)
|
||||||
|
|
@ -231,27 +231,14 @@
|
||||||
|
|
||||||
;;;; Main types
|
;;;; Main types
|
||||||
|
|
||||||
#?(:clj
|
(defrecord Signal
|
||||||
(defmacro def-signal-record
|
;; Telemere's main public data type, we avoid nesting and duplication
|
||||||
"Defines Telemere's main public data type, we avoid nesting and duplication."
|
[schema inst uid,
|
||||||
[]
|
location ns line column file, host thread _otel-context,
|
||||||
(let [fields
|
sample-rate, kind id level, ctx parent root, data kvs msg_,
|
||||||
(if (:ns &env)
|
error run-form run-val end-inst run-nsecs]
|
||||||
'[schema inst uid,
|
|
||||||
location ns line column file,
|
Object (toString [sig] (str "#" `Signal (into {} sig))))
|
||||||
;; 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])]
|
|
||||||
|
|
||||||
`(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
|
||||||
|
|
@ -641,9 +628,9 @@
|
||||||
(let [clause [(if run-form :run :no-run) (if clj? :clj :cljs)]]
|
(let [clause [(if run-form :run :no-run) (if clj? :clj :cljs)]]
|
||||||
(case clause
|
(case clause
|
||||||
[:run :clj ] `(Signal. 1 ~'__inst ~'__uid, ~location ~'__ns ~line-form ~column-form ~file-form, (enc/host-info) ~'__thread ~'__otel-context1, ~sample-rate-form, ~'__kind ~'__id ~'__level, ~ctx-form ~parent-form ~'__root1, ~data-form ~kvs-form ~'_msg_, ~'_run-err '~run-form ~'_run-val ~'_end-inst ~'_run-nsecs)
|
[:run :clj ] `(Signal. 1 ~'__inst ~'__uid, ~location ~'__ns ~line-form ~column-form ~file-form, (enc/host-info) ~'__thread ~'__otel-context1, ~sample-rate-form, ~'__kind ~'__id ~'__level, ~ctx-form ~parent-form ~'__root1, ~data-form ~kvs-form ~'_msg_, ~'_run-err '~run-form ~'_run-val ~'_end-inst ~'_run-nsecs)
|
||||||
[:run :cljs] `(Signal. 1 ~'__inst ~'__uid, ~location ~'__ns ~line-form ~column-form ~file-form, ~sample-rate-form, ~'__kind ~'__id ~'__level, ~ctx-form ~parent-form ~'__root1, ~data-form ~kvs-form ~'_msg_, ~'_run-err '~run-form ~'_run-val ~'_end-inst ~'_run-nsecs)
|
[:run :cljs] `(Signal. 1 ~'__inst ~'__uid, ~location ~'__ns ~line-form ~column-form ~file-form, nil nil nil ~sample-rate-form, ~'__kind ~'__id ~'__level, ~ctx-form ~parent-form ~'__root1, ~data-form ~kvs-form ~'_msg_, ~'_run-err '~run-form ~'_run-val ~'_end-inst ~'_run-nsecs)
|
||||||
[:no-run :clj ] `(Signal. 1 ~'__inst ~'__uid, ~location ~'__ns ~line-form ~column-form ~file-form, (enc/host-info) ~'__thread ~'__otel-context1, ~sample-rate-form, ~'__kind ~'__id ~'__level, ~ctx-form ~parent-form ~'__root1, ~data-form ~kvs-form ~msg-form, ~error-form nil nil nil nil)
|
[:no-run :clj ] `(Signal. 1 ~'__inst ~'__uid, ~location ~'__ns ~line-form ~column-form ~file-form, (enc/host-info) ~'__thread ~'__otel-context1, ~sample-rate-form, ~'__kind ~'__id ~'__level, ~ctx-form ~parent-form ~'__root1, ~data-form ~kvs-form ~msg-form, ~error-form nil nil nil nil)
|
||||||
[:no-run :cljs] `(Signal. 1 ~'__inst ~'__uid, ~location ~'__ns ~line-form ~column-form ~file-form, ~sample-rate-form, ~'__kind ~'__id ~'__level, ~ctx-form ~parent-form ~'__root1, ~data-form ~kvs-form ~msg-form, ~error-form nil nil nil nil)
|
[:no-run :cljs] `(Signal. 1 ~'__inst ~'__uid, ~location ~'__ns ~line-form ~column-form ~file-form, nil nil nil ~sample-rate-form, ~'__kind ~'__id ~'__level, ~ctx-form ~parent-form ~'__root1, ~data-form ~kvs-form ~msg-form, ~error-form nil nil nil nil)
|
||||||
(enc/unexpected-arg! clause {:context :signal-constructor-args})))
|
(enc/unexpected-arg! clause {:context :signal-constructor-args})))
|
||||||
|
|
||||||
record-form
|
record-form
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue