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 29, 2024
1 parent b9a8a19 commit 5aecb88
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 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
36 changes: 18 additions & 18 deletions src/taoensso/timbre.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,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 @@ -427,15 +427,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 @@ -729,11 +730,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 @@ -744,12 +745,11 @@

#?(:clj
(defmacro -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 5aecb88

Please sign in to comment.