Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'dev': v0.8.1

  • Loading branch information...
commit d28429f4f3fa84133be0d51f7a28126feed9b380 2 parents 6596919 + 1fce815
Peter Taoussanis authored
Showing with 17 additions and 21 deletions.
  1. +2 −2 README.md
  2. +2 −8 project.clj
  3. +13 −11 src/taoensso/timbre.clj
4 README.md
View
@@ -1,7 +1,7 @@
Current [semantic](http://semver.org/) version:
```clojure
-[com.taoensso/timbre "0.8.0"]
+[com.taoensso/timbre "0.8.1"]
```
**Breaking changes** since _0.7.x_:
@@ -45,7 +45,7 @@ lein2 all test
Depend on Timbre in your `project.clj`:
```clojure
-[com.taoensso/timbre "0.8.0"]
+[com.taoensso/timbre "0.8.1"]
```
and `use` the library:
10 project.clj
View
@@ -1,4 +1,4 @@
-(defproject com.taoensso/timbre "0.8.0"
+(defproject com.taoensso/timbre "0.8.1"
:description "Simple, flexible, all-Clojure logging. No XML!"
:url "https://github.com/ptaoussanis/timbre"
:license {:name "Eclipse Public License"}
@@ -6,15 +6,9 @@
[clj-stacktrace "0.2.4"]]
:profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}
- :1.5 {:dependencies [[org.clojure/clojure "1.5.0-master-SNAPSHOT"]]}
+ :1.5 {:dependencies [[org.clojure/clojure "1.5.0-alpha3"]]}
:dev {:dependencies []}
:test {:dependencies []}}
- :repositories {"sonatype" {:url "http://oss.sonatype.org/content/repositories/releases"
- :snapshots false
- :releases {:checksum :fail :update :always}}
- "sonatype-snapshots" {:url "http://oss.sonatype.org/content/repositories/snapshots"
- :snapshots true
- :releases {:checksum :fail :update :always}}}
:aliases {"test-all" ["with-profile" "test,1.3:test,1.4:test,1.5" "test"]}
:min-lein-version "2.0.0"
:warn-on-reflection true)
24 src/taoensso/timbre.clj
View
@@ -44,7 +44,7 @@
:timestamp-pattern "yyyy-MMM-dd HH:mm:ss ZZ" ; SimpleDateFormat pattern
:timestamp-locale nil ; A Locale object, or nil
- ;;; Control :prefix format
+ ;; Control :prefix format
:prefix-fn
(fn [{:keys [level timestamp hostname ns]}]
(str timestamp " " hostname " " (-> level name str/upper-case)
@@ -233,10 +233,10 @@
(defmacro log*
"Prepares given arguments for, and then dispatches to all relevant
appender-fns."
- [level base-args & args]
+ [level base-args & sigs]
(assert-valid-level level)
`(when-let [juxt-fn# (@appenders-juxt-cache ~level)] ; Any relevant appenders?
- (let [[x1# & xs#] (list ~@args)
+ (let [[x1# & xs#] (list ~@sigs)
has-throwable?# (instance? Throwable x1#)
appender-args#
@@ -259,18 +259,19 @@
"When logging is enabled, actually logs given arguments with relevant
appender-fns. Generic form of standard level-loggers (trace, info, etc.)."
{:arglists '([level message & more] [level throwable message & more])}
- [level & args]
+ [level & sigs]
(assert-valid-level level)
`(when (logging-enabled? ~level)
- (log* ~level {} ~@args)))
+ (log* ~level {} ~@sigs)))
(defmacro spy
- "Evaluates expression and logs its form and result. Always returns the result.
- Defaults to :debug logging level."
+ "Evaluates named expression and logs its result. Always returns the result.
+ Defaults to :debug logging level and unevaluated expression as name."
([expr] `(spy :debug ~expr))
- ([level expr]
+ ([level expr] `(spy ~level '~expr ~expr))
+ ([level name expr]
`(try
- (let [result# ~expr] (log ~level '~expr ~expr) result#)
+ (let [result# ~expr] (log ~level ~name ~expr) result#)
(catch Exception e#
(log ~level '~expr (str "\n" (stacktrace/pst-str e#)))
(throw e#)))))
@@ -281,8 +282,8 @@
`(defmacro ~(symbol level-name)
~(str "Log given arguments at " (str/capitalize level-name) " level.")
~'{:arglists '([message & more] [throwable message & more])}
- [& args#]
- `(log ~~level ~@args#))))
+ [& sigs#]
+ `(log ~~level ~@sigs#))))
(defmacro ^:private def-loggers
[] `(do ~@(map (fn [level] `(def-logger ~level)) ordered-levels)))
@@ -306,5 +307,6 @@
(time (dotimes [n 10000] (trace "This won't log"))) ; Overhead 5ms/10ms
(time (dotimes [n 5] (info "foo" "bar")))
(spy (* 6 5 4 3 2 1))
+ (spy :debug :factorial6 (* 6 5 4 3 2 1))
(info (Exception. "noes!") "bar")
(spy (/ 4 0)))
Please sign in to comment.
Something went wrong with that request. Please try again.