mirror of https://github.com/status-im/timbre.git
Merge branch 'dev'
This commit is contained in:
commit
e18f3a4c41
|
@ -1,7 +1,7 @@
|
||||||
Current [semantic](http://semver.org/) version:
|
Current [semantic](http://semver.org/) version:
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
[com.taoensso/timbre "1.3.0"]
|
[com.taoensso/timbre "1.3.1"]
|
||||||
```
|
```
|
||||||
|
|
||||||
# Timbre, a (sane) Clojure logging & profiling library
|
# Timbre, a (sane) Clojure logging & profiling library
|
||||||
|
@ -27,7 +27,7 @@ Timbre is an attempt to make **simple logging simple** and more **complex loggin
|
||||||
Depend on Timbre in your `project.clj`:
|
Depend on Timbre in your `project.clj`:
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
[com.taoensso/timbre "1.3.0"]
|
[com.taoensso/timbre "1.3.1"]
|
||||||
```
|
```
|
||||||
|
|
||||||
and `use` the library:
|
and `use` the library:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(defproject com.taoensso/timbre "1.3.0"
|
(defproject com.taoensso/timbre "1.3.1"
|
||||||
: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"}
|
||||||
|
|
|
@ -31,11 +31,11 @@
|
||||||
(def default-err (java.io.PrintWriter. System/err))
|
(def default-err (java.io.PrintWriter. System/err))
|
||||||
|
|
||||||
(defmacro with-default-outs
|
(defmacro with-default-outs
|
||||||
"Executes body with Clojure's default *out* and *err* bindings."
|
"Evaluates body with Clojure's default *out* and *err* bindings."
|
||||||
[& body] `(binding [*out* default-out *err* default-err] ~@body))
|
[& body] `(binding [*out* default-out *err* default-err] ~@body))
|
||||||
|
|
||||||
(defmacro with-err-as-out
|
(defmacro with-err-as-out
|
||||||
"Executes body with *err* bound to *out*."
|
"Evaluates body with *err* bound to *out*."
|
||||||
[& body] `(binding [*err* *out*] ~@body))
|
[& body] `(binding [*err* *out*] ~@body))
|
||||||
|
|
||||||
;;;; Default configuration and appenders
|
;;;; Default configuration and appenders
|
||||||
|
@ -65,6 +65,17 @@
|
||||||
:ns-whitelist []
|
:ns-whitelist []
|
||||||
:ns-blacklist []
|
:ns-blacklist []
|
||||||
|
|
||||||
|
;; TODO Generalized transformation/filtering unary fns to operate on
|
||||||
|
;; logging requests to either either filter or transform logging
|
||||||
|
;; messages (e.g. obscure security credentials).
|
||||||
|
;;
|
||||||
|
;; Could use a cacheable comp/juxt and include ns white/black list
|
||||||
|
;; functionality? Possibly even just prepend to the regular appender
|
||||||
|
;; juxt (assuming we keep ns filtering separate)? Note that this'd
|
||||||
|
;; also make any additional middlware cost async-able.
|
||||||
|
;;
|
||||||
|
;; :middleware []
|
||||||
|
|
||||||
;;; Control :timestamp format
|
;;; Control :timestamp format
|
||||||
:timestamp-pattern "yyyy-MMM-dd HH:mm:ss ZZ" ; SimpleDateFormat pattern
|
:timestamp-pattern "yyyy-MMM-dd HH:mm:ss ZZ" ; SimpleDateFormat pattern
|
||||||
:timestamp-locale nil ; A Locale object, or nil
|
:timestamp-locale nil ; A Locale object, or nil
|
||||||
|
@ -225,7 +236,7 @@
|
||||||
(apply juxt))))))))
|
(apply juxt))))))))
|
||||||
(reset! appenders-juxt-cache)))
|
(reset! appenders-juxt-cache)))
|
||||||
|
|
||||||
;;; Namespace filter ; TODO Generalize to arbitrary fn filters?
|
;;; Namespace filter ; TODO Generalize to arbitrary configurable middleware juxt?
|
||||||
|
|
||||||
(def ns-filter-cache "@ns-filter-cache => (fn relevant-ns? [ns] ...)"
|
(def ns-filter-cache "@ns-filter-cache => (fn relevant-ns? [ns] ...)"
|
||||||
(atom (constantly true)))
|
(atom (constantly true)))
|
||||||
|
@ -308,11 +319,15 @@
|
||||||
([level expr] `(spy ~level '~expr ~expr))
|
([level expr] `(spy ~level '~expr ~expr))
|
||||||
([level name expr]
|
([level name expr]
|
||||||
`(try
|
`(try
|
||||||
(let [result# ~expr] (log ~level ~name ~expr) result#)
|
(let [result# ~expr] (log ~level ~name result#) result#)
|
||||||
(catch Exception e#
|
(catch Exception e#
|
||||||
(log ~level '~expr (str "\n" (stacktrace/pst-str e#)))
|
(log ~level '~expr (str "\n" (stacktrace/pst-str e#)))
|
||||||
(throw e#)))))
|
(throw e#)))))
|
||||||
|
|
||||||
|
(defmacro s ; Alias
|
||||||
|
{:arglists '([expr] [level expr] [level name expr])}
|
||||||
|
[& args] `(spy ~@args))
|
||||||
|
|
||||||
(defmacro ^:private def-logger
|
(defmacro ^:private def-logger
|
||||||
[level]
|
[level]
|
||||||
(let [level-name (name level)]
|
(let [level-name (name level)]
|
||||||
|
|
Loading…
Reference in New Issue