diff --git a/src/taoensso/timbre.clj b/src/taoensso/timbre.clj index 0bffb4d..76ef569 100644 --- a/src/taoensso/timbre.clj +++ b/src/taoensso/timbre.clj @@ -174,7 +174,7 @@ (let [timers (atom {})] ; {:hash last-appended-time-msecs ...} (fn [{ns :ns [x1 & _] :args :as apfn-args}] (let [now (System/currentTimeMillis) - hash (str ns "/" x1) + hash (str ns "/" x1) ; TODO Alternatives? limit? (fn [last-msecs] (and last-msecs (<= (- now last-msecs) limit-per-msecs)))] diff --git a/src/taoensso/timbre/appenders/postal.clj b/src/taoensso/timbre/appenders/postal.clj index dfcc7bc..a51136e 100644 --- a/src/taoensso/timbre/appenders/postal.clj +++ b/src/taoensso/timbre/appenders/postal.clj @@ -17,6 +17,7 @@ (let [[subject & body] args] (postal/send-message (assoc postal-config + ;; TODO Better to just use trunc'd message as subject? :subject (str prefix " - " (or subject throwable)) :body (str (str/join \space body) - (timbre/stacktrace throwable "\n")))))))}) \ No newline at end of file + (timbre/stacktrace throwable "\n")))))))}) diff --git a/src/taoensso/timbre/utils.clj b/src/taoensso/timbre/utils.clj index 6a66180..9c34adf 100644 --- a/src/taoensso/timbre/utils.clj +++ b/src/taoensso/timbre/utils.clj @@ -13,13 +13,13 @@ (defn memoize-ttl "Like `memoize` but invalidates the cache for a set of arguments after TTL msecs has elapsed." - [ttl f] + [ttl-ms f] (let [cache (atom {})] (fn [& args] (let [{:keys [time-cached d-result]} (@cache args) now (System/currentTimeMillis)] - (if (and time-cached (< (- now time-cached) ttl)) + (if (and time-cached (< (- now time-cached) ttl-ms)) @d-result (let [d-result (delay (apply f args))] (swap! cache assoc args {:time-cached now :d-result d-result}) @@ -63,4 +63,4 @@ ~name (keyword (str ~*ns*) (clojure.core/name ~name)))) -(comment (map #(fq-keyword %) ["foo" :foo :foo/bar])) \ No newline at end of file +(comment (map #(fq-keyword %) ["foo" :foo :foo/bar]))