Message formatting: don't call `format` unless formatting args are provided

This commit is contained in:
Peter Taoussanis 2013-12-02 17:26:25 +07:00
parent a7fbaf087a
commit a547674bc2
2 changed files with 3 additions and 1 deletions

View File

@ -27,6 +27,7 @@ Overall quite happy with the state of Timbre as of this release. No major antici
### Fixes
* [#38] Broken namespace filter (mlb-).
* [unreported] Messages are now generated _after_ middleware has been applied, allowing better filtering performance and more intuitive behaviour (e.g. changes to args in middleware will now automatically percolate to message content).
* [unreported] (logf <level> "hello %s") was throwing due to lack of formatting args.
## v2.6.3 → v2.7.1

View File

@ -296,7 +296,8 @@
(assoc :message
(when-not (empty? args)
(case msg-type
:format (apply format args)
:format (if-not (next args) (str args)
(apply format args))
:print-str (apply print-str args)
:nil nil)))))
juxtfn-args (assoc juxtfn-args :timestamp (timestamp-fn instant))