Housekeeping

This commit is contained in:
Peter Taoussanis 2013-02-11 11:55:38 +07:00
parent 0513eb80de
commit 5864673b47
2 changed files with 6 additions and 7 deletions

View File

@ -59,7 +59,7 @@ There's little overhead for checking logging levels:
(time (trace (Thread/sleep 5000))) (time (trace (Thread/sleep 5000)))
%> "Elapsed time: 0.054 msecs" %> "Elapsed time: 0.054 msecs"
(time (when true)) (time (when false))
%> "Elapsed time: 0.051 msecs" %> "Elapsed time: 0.051 msecs"
``` ```
@ -122,7 +122,7 @@ Filter logging output by namespaces:
To enable the standard [Postal](https://github.com/drewr/postal)-based email appender, add the Postal dependency to your `project.clj`: To enable the standard [Postal](https://github.com/drewr/postal)-based email appender, add the Postal dependency to your `project.clj`:
```clojure ```clojure
[com.draines/postal "1.9.1"] [com.draines/postal "1.9.2"]
``` ```
And add the appender to your `ns` declaration: And add the appender to your `ns` declaration:

View File

@ -147,9 +147,8 @@
(let [now (System/currentTimeMillis) (let [now (System/currentTimeMillis)
hash (str ns "/" message) hash (str ns "/" message)
allow? (fn [last-msecs] allow? (fn [last-msecs]
(if last-msecs (or (not last-msecs)
(> (- now last-msecs) max-message-per-msecs) (> (- now last-msecs) max-message-per-msecs)))]
true))]
(when (allow? (@flood-timers hash)) (when (allow? (@flood-timers hash))
(apfn apfn-args) (apfn apfn-args)
@ -187,12 +186,12 @@
(def get-hostname (def get-hostname
(utils/memoize-ttl (utils/memoize-ttl
60000 (fn [] (try (.. java.net.InetAddress getLocalHost getHostName) 60000 (fn [] (try (.. java.net.InetAddress getLocalHost getHostName)
(catch java.net.UnknownHostException e (catch java.net.UnknownHostException _
"UnknownHost"))))) "UnknownHost")))))
(defn- wrap-appender-juxt (defn- wrap-appender-juxt
"Wraps compile-time appender juxt with additional runtime capabilities "Wraps compile-time appender juxt with additional runtime capabilities
(incl. middleware) controller by compile-time config. Like `wrap-appender-fn` (incl. middleware) controlled by compile-time config. Like `wrap-appender-fn`
but operates on the entire juxt at once." but operates on the entire juxt at once."
[juxtfn] [juxtfn]
(->> ; Wrapping applies capabilities bottom-to-top (->> ; Wrapping applies capabilities bottom-to-top