From 64dc0f52aacf554f1c43a74404915d02a54f2e6d Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Wed, 29 Jun 2016 11:15:45 +0700 Subject: [PATCH] Assist with https://github.com/fzakaria/slf4j-timbre/issues/20 Users have reported seeing `Wrong number of args (9) passed to: timbre/-log!` errors via slf4j-timbre when upgrading from Timbre v4.4.0 -> v4.5.0. slf4j-timbre already uses the correct public API (timbre/log!), so this looks like an AOT issue: a compiled Timbre v4.4.0 `log!` macro expansion is calling a `v4.5.0` `-log!` function and breaking. Unfortunately, looks[1] like a user-level call to `lein clean` isn't enough to resolve the issue. Might be that slf4j-timbre itself needs to be recompiled? Whatever the underlying cause, this should be a reasonable workaround for now. [1] : https://github.com/fzakaria/slf4j-timbre/issues/20#issuecomment-229254285 --- src/taoensso/timbre.cljx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/taoensso/timbre.cljx b/src/taoensso/timbre.cljx index 8261d42..66e7e5a 100644 --- a/src/taoensso/timbre.cljx +++ b/src/taoensso/timbre.cljx @@ -358,8 +358,16 @@ (infof ^:meta {:err (Exception. "ex")} "Hi %s" "steve")) (defn -log! "Core low-level log fn. Implementation detail!" - [config level ?ns-str ?file ?line msg-type ?err vargs_ - ?base-data callsite-id] + + ;; TODO Temp workaround for + ;; https://github.com/fzakaria/slf4j-timbre/issues/20 and similar AOT tools + ([config level ?ns-str ?file ?line msg-type ?err vargs_ ?base-data] + ;; (throw (ex-info "Invalid internal Timbre call. Please try run `lein clean` to clear out-of-date build artifacts." {})) + (-log! config level ?ns-str ?file ?line msg-type ?err vargs_ + ?base-data nil)) + + ([config level ?ns-str ?file ?line msg-type ?err vargs_ + ?base-data callsite-id] (when (log? level ?ns-str config) ; Runtime check (let [instant (enc/now-dt) @@ -490,7 +498,7 @@ (apfn data)))))))) nil (:appenders config)))))) - nil) + nil)) (comment (-log! *config* :info nil nil nil :p :auto