Fix `config` docstring

This commit is contained in:
Peter Taoussanis 2012-12-28 13:59:17 +07:00
parent f16b00a7e9
commit 7c81fc58de
3 changed files with 26 additions and 17 deletions

View File

@ -3,6 +3,7 @@
:url "https://github.com/ptaoussanis/timbre"
:license {:name "Eclipse Public License"}
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/tools.macro "0.1.1"]
[clj-stacktrace "0.2.5"]]
:profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}

View File

@ -16,8 +16,7 @@
(print (str (str/join \space xs) \newline))
(flush))
(defonce config
^{:doc
(utils/defonce* config
"This map atom controls everything about the way Timbre operates. In
particular note the flexibility to add arbitrary appenders.
@ -33,7 +32,7 @@
Other keys include: :instant, :timestamp, :hostname, :ns, :error?
See source code for examples and `utils/deep-merge` for a convenient way
to reconfigure appenders."}
to reconfigure appenders."
(atom {:current-level :debug
;;; Control log filtering by namespace patterns (e.g. ["my-app.*"]).

View File

@ -1,5 +1,14 @@
(ns taoensso.timbre.utils
{:author "Peter Taoussanis"})
{:author "Peter Taoussanis"}
(:require [clojure.tools.macro :as macro]))
(defmacro defonce*
"Like `clojure.core/defonce` but supports optional docstring and attributes
map for name symbol."
{:arglists '([name expr])}
[name & sigs]
(let [[name [expr]] (macro/name-with-attributes name sigs)]
`(clojure.core/defonce ~name ~expr)))
(defn memoize-ttl
"Like `memoize` but invalidates the cache for a set of arguments after TTL