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

@ -2,8 +2,9 @@
:description "Clojure logging & profiling library" :description "Clojure logging & profiling library"
:url "https://github.com/ptaoussanis/timbre" :url "https://github.com/ptaoussanis/timbre"
:license {:name "Eclipse Public License"} :license {:name "Eclipse Public License"}
:dependencies [[org.clojure/clojure "1.3.0"] :dependencies [[org.clojure/clojure "1.3.0"]
[clj-stacktrace "0.2.5"]] [org.clojure/tools.macro "0.1.1"]
[clj-stacktrace "0.2.5"]]
:profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]} :profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]} :1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.0-alpha3"]]} :1.5 {:dependencies [[org.clojure/clojure "1.5.0-alpha3"]]}

View File

@ -16,24 +16,23 @@
(print (str (str/join \space xs) \newline)) (print (str (str/join \space xs) \newline))
(flush)) (flush))
(defonce config (utils/defonce* config
^{:doc "This map atom controls everything about the way Timbre operates. In
"This map atom controls everything about the way Timbre operates. In particular note the flexibility to add arbitrary appenders.
particular note the flexibility to add arbitrary appenders.
An appender is a map with keys: An appender is a map with keys:
:doc, :min-level, :enabled?, :async?, :max-message-per-msecs, :fn? :doc, :min-level, :enabled?, :async?, :max-message-per-msecs, :fn?
An appender's fn takes a single map argument with keys: An appender's fn takes a single map argument with keys:
:level, :message, :more ; From all logging macros (`info`, etc.) :level, :message, :more ; From all logging macros (`info`, etc.)
:profiling-stats ; From `profile` macro :profiling-stats ; From `profile` macro
:ap-config ; `shared-appender-config` :ap-config ; `shared-appender-config`
:prefix ; Output of `prefix-fn` :prefix ; Output of `prefix-fn`
Other keys include: :instant, :timestamp, :hostname, :ns, :error? Other keys include: :instant, :timestamp, :hostname, :ns, :error?
See source code for examples and `utils/deep-merge` for a convenient way See source code for examples and `utils/deep-merge` for a convenient way
to reconfigure appenders."} to reconfigure appenders."
(atom {:current-level :debug (atom {:current-level :debug
;;; Control log filtering by namespace patterns (e.g. ["my-app.*"]). ;;; Control log filtering by namespace patterns (e.g. ["my-app.*"]).

View File

@ -1,5 +1,14 @@
(ns taoensso.timbre.utils (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 (defn memoize-ttl
"Like `memoize` but invalidates the cache for a set of arguments after TTL "Like `memoize` but invalidates the cache for a set of arguments after TTL