diff --git a/README.md b/README.md index a5cc4c0..c5a3ca6 100644 --- a/README.md +++ b/README.md @@ -76,14 +76,6 @@ java.lang.Exception: Oh noes <...> ``` -### Timbre slowing down your Clojure app shutdown? - -This is due to an outstanding [issue](http://dev.clojure.org/jira/browse/CLJ-124) in Clojure. As a workaround, add the following to your application's startup routine: - -```clojure -(.addShutdownHook (Runtime/getRuntime) (Thread. (fn [] (shutdown-agents)))) -``` - ### Configuration This is the biggest win over Java logging IMO. Here's `timbre/example-config` (also Timbre's default config): diff --git a/src/taoensso/timbre.cljx b/src/taoensso/timbre.cljx index dda9f6d..46fe859 100644 --- a/src/taoensso/timbre.cljx +++ b/src/taoensso/timbre.cljx @@ -555,3 +555,10 @@ [probability & body] `(do (assert (<= 0 ~probability 1) "Probability: 0 <= p <= 1") (when (< (rand) ~probability) ~@body))) + +;;;; Shutdown hook ; Workaround for http://dev.clojure.org/jira/browse/CLJ-124 + +#+clj +(defonce ^:private shutdown-hook + (.addShutdownHook (Runtime/getRuntime) + (Thread. (fn [] (shutdown-agents)))))