Make calls to logging functions create deterministic code

This commit is contained in:
Pedro Pombeiro 2019-06-07 07:50:59 +02:00
parent 22603b5134
commit a6942de95e
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
2 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,4 @@
(defproject com.taoensso/timbre "4.10.0" (defproject status-im/timbre "4.10.0-2-status"
:author "Peter Taoussanis <https://www.taoensso.com>" :author "Peter Taoussanis <https://www.taoensso.com>"
:description "Pure Clojure/Script logging library" :description "Pure Clojure/Script logging library"
:url "https://github.com/ptaoussanis/timbre" :url "https://github.com/ptaoussanis/timbre"

View File

@ -535,14 +535,19 @@
;; NB waiting on CLJ-865: ;; NB waiting on CLJ-865:
?line (fline &form)}} opts ?line (fline &form)}} opts
?file (when (not= ?file "NO_SOURCE_PATH") ?file) ?file (when-not (or (= ?file "NO_SOURCE_PATH")
(-> ?file
(str/split #"/")
last
(.startsWith "form-init")))
?file)
;; Identifies this particular macro expansion; note that this'll ;; Identifies this particular macro expansion; note that this'll
;; be fixed for any fns wrapping `log!` (notably `tools.logging`, ;; be fixed for any fns wrapping `log!` (notably `tools.logging`,
;; `slf4j-timbre`, etc.): ;; `slf4j-timbre`, etc.):
callsite-id callsite-id
(hash [level msg-type args ; Unevaluated args (arg forms) (hash [level msg-type args ; Unevaluated args (arg forms)
?ns-str ?file ?line (rand)])] ?ns-str ?file ?line])]
`(-log! ~config ~level ~?ns-str ~?file ~?line ~msg-type ~?err `(-log! ~config ~level ~?ns-str ~?file ~?line ~msg-type ~?err
(delay [~@args]) ~?base-data ~callsite-id))))) (delay [~@args]) ~?base-data ~callsite-id)))))