diff --git a/common/src/clj/enoki/logging_macros.clj b/common/src/clj/enoki/logging_macros.clj index a5d0e42..fa9bb04 100644 --- a/common/src/clj/enoki/logging_macros.clj +++ b/common/src/clj/enoki/logging_macros.clj @@ -1,4 +1,10 @@ ;; A set of macros that defer to implementation-specific logging functions. +;; +;; Implementations must provide the `enoki.logging` namespace, and define a +;; logging function within that namespace that looks like: +;; +;; (fn log* [logger-name level eval-msg-fn]) +;; ;; Messages are not evaluated unless the message priority exceeds the relevant ;; logging level. @@ -6,17 +12,17 @@ (defmacro log "Delegates logging to function in implementation-defined namespace." - [level msg args] - `(enoki.logging/log* ~(str *ns*) ~level #(format (str ~msg) ~@args))) + [level msg] + `(enoki.logging/log* ~(str *ns*) ~level #(str ~msg))) -(defmacro debug [msg & args] - `(log :debug ~msg ~args)) +(defmacro debug [msg] + `(log :debug ~msg)) -(defmacro info [msg & args] - `(log :info ~msg ~args)) +(defmacro info [msg] + `(log :info ~msg)) -(defmacro warn [msg & args] - `(log :warn ~msg ~args)) +(defmacro warn [msg] + `(log :warn ~msg)) -(defmacro error [msg & args] - `(log :error ~msg ~args)) +(defmacro error [msg] + `(log :error ~msg)) diff --git a/swing/src/enoki/graphics/java2d.clj b/swing/src/enoki/graphics/java2d.clj index 8e82fcc..ee9bc6c 100644 --- a/swing/src/enoki/graphics/java2d.clj +++ b/swing/src/enoki/graphics/java2d.clj @@ -32,7 +32,7 @@ (seesaw/pack! frame) (seesaw/show! frame)) (.createBufferStrategy canvas 2) - (log/debug "width=%d, height=%d" (.getWidth canvas) (.getHeight canvas))) + (log/debug (format "width=%d, height=%d" (.getWidth canvas) (.getHeight canvas)))) (display-width [_] (.getWidth canvas)) diff --git a/swing/src/enoki/swing.clj b/swing/src/enoki/swing.clj index fcbb61d..467e897 100644 --- a/swing/src/enoki/swing.clj +++ b/swing/src/enoki/swing.clj @@ -24,7 +24,7 @@ (defn- handle-key-event [event-type e] (if-let [key-name (get key-names (.getKeyCode e))] (kbd/enqueue-event! event-type key-name) - (log/debug "unprocessable key event (%s): %s" event-type e))) + (log/debug (format "unprocessable key event (%s): %s" event-type e)))) (defn create-frame [] (doto (seesaw/frame :resizable? false) diff --git a/web/src/cljs/enoki/web.cljs b/web/src/cljs/enoki/web.cljs index 91caa3c..2bdde6c 100644 --- a/web/src/cljs/enoki/web.cljs +++ b/web/src/cljs/enoki/web.cljs @@ -29,7 +29,7 @@ (do (kbd/enqueue-event! event-type key-name) (.preventDefault e)) - (log/info "unprocessable key event (%s): %s" event-type (.-keyCode e)))) + (log/info (format "unprocessable key event (%s): %s" event-type (.-keyCode e))))) (defn capture-key-events! [element] (doto element