Skip to content

Commit

Permalink
[nop] Update to latest Encore API
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Aug 30, 2024
1 parent 9e4ad46 commit 73bf805
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

:dev [:dev+ :community #_:deploy]
:dev+
{:jvm-opts ["-server" "-Dtaoensso.elide-deprecated=true"]
{:jvm-opts ["-server" #_"-Dtaoensso.elide-deprecated=true"]
:global-vars
{*warn-on-reflection* true
*assert* true
Expand Down
38 changes: 19 additions & 19 deletions src/taoensso/timbre.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#?(:cljs (:require-macros [taoensso.timbre])))

(enc/assert-min-encore-version [3 85 0])
(enc/assert-min-encore-version [3 117 0])

(comment
(remove-ns 'taoensso.timbre)
Expand Down Expand Up @@ -323,8 +323,8 @@

(comment (get-timestamp default-timestamp-opts (enc/now-udt)))

#?(:clj (defn ^:no-doc get-?hostname "Returns uncached local hostname string, or nil." [] (enc/get-hostname nil)))
#?(:clj (defn get-hostname "Returns cached local hostname string." ^String [] (enc/get-hostname (enc/msecs :mins 1) 5000 "UnknownHost")))
#?(:clj (defn ^:no-doc get-?hostname "Returns uncached local hostname string, or nil." [] (enc/hostname nil)))
#?(:clj (defn get-hostname "Returns cached local hostname string." ^String [] (enc/hostname (enc/msecs :mins 1) 5000 "UnknownHost")))

#?(:clj
(defn ansi-color [color]
Expand Down Expand Up @@ -425,15 +425,16 @@

(defn- protected-fn [error-msg f]
(fn [data]
(enc/catching (f data) t
(let [{:keys [level ?ns-str ?file ?line]} data]
(throw
(ex-info error-msg
{:output-fn f
:level level
:loc {:ns ?ns-str, :file ?file, :line ?line}
:log-data data}
t))))))
(enc/try* (f data)
(catch :all t
(let [{:keys [level ?ns-str ?file ?line]} data]
(throw
(ex-info error-msg
{:output-fn f
:level level
:loc {:ns ?ns-str, :file ?file, :line ?line}
:log-data data}
t)))))))

(comment ((protected-fn "Whoops" (fn [data] (/ 1 0))) {}))

Expand Down Expand Up @@ -725,11 +726,11 @@

#?(:clj
(do
(defmacro log-errors [& body] `(enc/catching (do ~@body) t# (log! :error nil nil {:loc ~(enc/get-source &form &env), :?err t#})))
(defmacro logged-future [& body] `(future (enc/catching (do ~@body) t# (log! :error nil nil {:loc ~(enc/get-source &form &env), :?err t#}))))
(defmacro log-errors [& body] `(enc/try* (do ~@body) (catch :all t# (log! :error nil nil {:loc ~(enc/get-source &form &env), :?err t#}))))
(defmacro logged-future [& body] `(future (enc/try* (do ~@body) (catch :all t# (log! :error nil nil {:loc ~(enc/get-source &form &env), :?err t#})))))
(defmacro log-and-rethrow-errors [& body]
`(enc/catching (do ~@body) t#
(do
`(enc/try* (do ~@body)
(catch :all t#
(log! :error nil nil {:loc ~(enc/get-source &form &env), :?err t#})
(throw t#))))))

Expand All @@ -740,12 +741,11 @@

#?(:clj
(defmacro ^:no-doc -spy [loc config level name form]
`(enc/catching
`(enc/try*
(let [result# ~form]
(log! ~level :p [~name "=>" result#] ~{:loc loc, :config config, :spying? true})
result#)
t#
(do
(catch :all t#
(log! :error nil nil {:loc ~loc, :?err t#, :spying? true})
(throw t#)))))

Expand Down
2 changes: 1 addition & 1 deletion src/taoensso/timbre/appenders/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
stream)]

(binding [*out* stream]
(enc/println-atomic (force output_)))))))}))
(enc/println (force output_)))))))}))

(comment (println-appender))

Expand Down

0 comments on commit 73bf805

Please sign in to comment.